I've been struggling with this for far too long, and I don't see any error.
I've got a table that holds a bunch of locations. When I'm adding a location via my php script, I get an error of 'Wrong parameter count for mysql_query()'.
When I echo the mysql query, everything looks fine,and I can copy and and paste it into phpmyAdmin , everything runs perfectly.
The query looks like this
INSERT IGNORE INTO locations (name, address, city, state, zip) VALUES ('Soboba Casino','23333 Soboba Road', 'San Jacinto', 'CA', '92581')
Am I missing something? Why would this not run in my script, but run in phpmyAdmin?
Sorry, Missed putting in the php, the offensive php seems pretty straight forward
// insert the venue
$insertLoc="INSERT IGNORE INTO locastions (loc, address, city, state, zip) VALUES ('$venueName','$streetAddress', '$city', '$state', '$zip')";
echo $insertLoc;
mysql_query($insertLoc)or die(mysql_query());
-
That's a PHP error, not a MySQL error. Check your PHP code, and post it if you need more help.
Edited answer after question edit: It's the die() clause.
mysql_querywants at least one parameter. Someone else recommended usingmysql_error(),which is probably what you meant to do. -
Could you please show the PHP causing this error? If I were to guess I'd say it's a misplaced quote in the SQL you're creating, causing the parameter count to be off.
mysql_query("INSERT IGNORE INTO locations (name, address, city, state, zip) VALUES ('$place", '$address', '$city', '$state', '$zip')");That would parse into multiple parameters.
-
Try replacing the third line with
mysql_query($insertLoc)or die(mysql_error());(Note that I've replaced the second
mysql_query()withmysql_error().)pedalpete : of course! how could I be so stupid as to now notice that! Thank you Pourquoi. -
or die(mysql_query());should beor die(mysql_error());Also, in your SQL I guess
locastionsshould belocations
0 comments:
Post a Comment