amites Posted January 31, 2008 Share Posted January 31, 2008 began testing this script on server and running into a new snag, $query = "INSERT INTO bil_location (state_id, city_id, name, description, street, zipcode, entered)" . "\n VALUES ('".$locstate."', '".$loccity."', '".$locname."', '".$locdesc."', '".$locadr."', '".$loczip."', now() )"; only error I get is: mysql_error almost certainly syntax but I'm not sure where to go with it... Quote Link to comment https://forums.phpfreaks.com/topic/88685-solved-simple-insert-works-on-mysql-5-not-on-4/ Share on other sites More sharing options...
pdkv2 Posted January 31, 2008 Share Posted January 31, 2008 Try this $query = "INSERT INTO bil_location (state_id, city_id, name, description, street, zipcode, entered)" . "\n VALUES ('".$locstate."', '".$loccity."', '".$locname."', '".$locdesc."', '".$locadr."', '".$loczip."','". now()."' )"; Quote Link to comment https://forums.phpfreaks.com/topic/88685-solved-simple-insert-works-on-mysql-5-not-on-4/#findComment-454208 Share on other sites More sharing options...
fenway Posted January 31, 2008 Share Posted January 31, 2008 Unless you ech your $query variable, you won't see it. Quote Link to comment https://forums.phpfreaks.com/topic/88685-solved-simple-insert-works-on-mysql-5-not-on-4/#findComment-454458 Share on other sites More sharing options...
PFMaBiSmAd Posted January 31, 2008 Share Posted January 31, 2008 Also, post the code that is executing the mysql_query() and is outputting: "mysql_error". Perhaps that code is not echoing correct and useful information and can be improved to get it to tell what the problem actually is. Based on what you have posted, this could be anything from a mysql server problem/no connection, no database selected, no mysql extension installed, a syntax error, a typo or wrong table or column name. Quote Link to comment https://forums.phpfreaks.com/topic/88685-solved-simple-insert-works-on-mysql-5-not-on-4/#findComment-454651 Share on other sites More sharing options...
amites Posted February 1, 2008 Author Share Posted February 1, 2008 I had talked my client into using a mySQL 5 server, though this still bothered me so I came back and looked at the code, noticed that I didn't have it set to echo out an error just execute the query $result = mysql_query($query); changed that to $result = mysql_query($query) or die(mysql_error); and now it works on mySQL 4, didn't change anything else strange... many thanks for taking the time to try and help Quote Link to comment https://forums.phpfreaks.com/topic/88685-solved-simple-insert-works-on-mysql-5-not-on-4/#findComment-455607 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.