On Fri, May 20, 2005 1:53 pm, Dustin Krysak said: > 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? How would we know? :-) Of the 10,000 PHP Database Abstraction classes out there, you haven't told us which one you are using. So there is *NO* *WAY* to tell what the query() method returns, is there? Actually, you don't even tell us which DATABASE you are using, so while I say MySQL below, I mean "whatever database you are using" When it *DOES* fail, why don't you log the error message MySQL provides? error_log(@mysql_error()); Only, most likely, the database abstraction layer you haven't told us about has some fancy method to get that information. > For some reason it is doing just the opposite. The data is added, but > it displays the error instead. Then, most likely, the particular database abstraction layer you have chosen doesn't work the same way as mysql_query(). So you have to adjust your code to work with the API of that database abstraction layer, which we can't possibly begin to tell you how to do, since we don't know what database abstraction software you are using. > Am I misunderstanding something? Definitely how to ask a good question :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php