Should this not return true?!?!

From: Date: Fri, 20 May 2005 20:53:08 +0000
Subject: Should this not return true?!?!
Groups: php.general 
Request: Send a blank email to php-general+get-215675@lists.php.net to get a copy of this message
Hi there (newbie here) - I have the following snippet of code...... $sexId = $_POST['sex']; $fName = $_POST['fName']; $lName = $_POST['lName']; if ($status = $db->query("INSERT INTO names (nameId, sexId, fName, lName) VALUES ('', $sexId, '$fName', '$lName')")) {
     print "Your data was added to the database successfully!";
} else {
     print "Your data could not be added to the database!";
} Assuming my query was successful, should it not return true and print the success message? For some reason it is doing just the opposite. The data is added, but it displays the error instead. Am I misunderstanding something? d

« previous php.general (#215675) next »