Should this not return true?!?!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux