ess14 Posted June 12, 2007 Share Posted June 12, 2007 can anyone tell me why the following code isnt working? $sql = mysql_query("INSERT INTO users (tracknum, username, address, state, city, phone, fax, email, groupn, isdone) VALUES('$tracknum', '$username', '$address', '$state', '$city', '$phone', '$fax', '$email', '$groupn', '$isdone')") or die (mysql_error()); I know all the variables exist before that statement. Is there anything else it can be? Im not getting any error codes or anything. only this... if(!$sql){ echo 'There has been an error creating your account.'; } Has anyone got any ideas of what it could be or how to get some more useful error messages? Quote Link to comment https://forums.phpfreaks.com/topic/55254-mysql-insert-not-working/ Share on other sites More sharing options...
Shazbot! Posted June 26, 2007 Share Posted June 26, 2007 I am assuming that this is a MSSQL server you are connecting to so you need to change the mysql to mssql. You can also try to remove the () for the column names INSERT INTO users tracknum, username, address, state, city, phone, fax, email, groupn, isdone VALUES ('$tracknum', '$username', '$address', '$state', '$city', '$phone', '$fax', '$email', '$groupn', '$isdone')") finally, if any of your fields are of type int then you will need to remove the ' ' for the values. Quote Link to comment https://forums.phpfreaks.com/topic/55254-mysql-insert-not-working/#findComment-283170 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.