MySQL returned an empty result set (i.e. zero rows).

:frowning: anyone can help me explain why i got this problem?? in my phpmyadmin?

I searched about this but I’ve found that it is related to my query? but i dont get it… all i notice that i cannot add entry to my table from my PHP script… everytime i try to run it on my browser… add_quote.php

some part of the script is:
[php]

include(‘includes/mysql_connect.php’);

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	
	If ( !empty($_POST['quote']) && !empty($_POST['soucre']) ) {
	
		$quote = mysql_real_escape_string(trim(strip_tags($_POST['quote'])), $dbc);
		
		$source = mysql_real_escape_string(trim(strip_tags($_POST['source'])), $dbc);
		
			if (isset($_POST['favorite'])) {
				$favorite = 1;
				
					} else {
						$favorite = 0;
						
					}
					
					$query = "INSERT INTO quotes(quote, source, favorite) VALUES ('$qoute', '$source', $favorite)";
					
					$r = mysql_query($query, $dbc);
					
						if (mysql_affected_rows($dbc) == 1) {
							
							print '<p>Your quotation has been stored.</p>';
							
						} else { 
						
							print '<p class="error">Cloud not store the qoute because: <br/>' . mysql_error($dbc) . '.</p><p>The query being run was: ' . $query . '</p>';
							
						}
						
					} else {
					
				print '<p class="error">Please enter a quotation and a source!</p>';
				
				}
			}

?>
[/php]

I can’t really tell you if this is the full problem but certainly a good place to start would be to fix all the spelling mistakes.

If ( !empty($_POST['quote']) && !empty($_POST['soucre']) ) { I assume that should be source ?

favorite) VALUES ('$qoute', should be quote ?

Thanks… maybe it’s my negligence… I’ll check this code again… :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service