01-07-2012, 09:04 PM
hello ppl i'm new here i have the assingments and i been working on its a project for the animal zoo to add animal , species enclosure etc but when i try to add the data into the forum i get the error says
could not run the query
i took 3 screen shot to give u better idea what and i have my msql set up right with the connection.inc.php file
01-08-2012, 01:48 AM
Remove the quotes from the VALUES fields in your query. The quotes around the fields treat those values as literals; e.g., the literal $Animal_Name, instead of the value the variable represents.
Another thing you can do to debug something like this is to print to the screen the exact sql query that you're trying to execute. It's been a while since I've written PHP, but I believe you do it like this:
01-08-2012, 08:47 PM
Vinyl-Junkies answer is wrong.
Oh, his point '$Animal_Name' will be seen as MySQL as a string literal is correct. But you *WANT* it to be seen as a string literal!!! Your INSERT will never work if those are not seen as MySQL as string literals. Without the apostrophes, the values can only be numbers or the names of columns in the DB.
Just *AFTER* you assign the sql string to the $sql variable, add in a DEBUG line:
echo "<hr/>DEBUG SQL: " . $sql . "<hr/>\n";
and then show us what that debug line shows you.