primcrew Posted January 26, 2011 Share Posted January 26, 2011 im just trying a simple test to add info to my db --Db info $HOST="----"; $USER="----"; $PASSWORD="----"; $DB="----"; $db_connect=" mysql_connect($HOST, $USER, $PASSWORD)"; $select_db="mysql_select_db($DB, $db_connect)"; if ($db_connect){print("Connected<br>");} else {print("error");} if ($select_db){print("Db-Connected<br>");} else {print("error");} --- php page info--- if ($_GET['new_customer_submit']){print("Form Submitted<br>"); $result="INSERT INTO 'test' ('cust_id','last_name') VALUES (' ' , '$_GET[new_customer_lastname]' )"; $result_ex = mysql_query($result); if ($result_ex){print("New Customer Added<br>");} else {print("Add Customer Error!<br>");} } else {print("New Form");} it says it connects fine and i see the results in the get link but it wont add to db Quote Link to comment Share on other sites More sharing options...
Maq Posted January 26, 2011 Share Posted January 26, 2011 I added tags around your code, please use them next time. Your code is hard to read due to lack of formatting. Try temporarily changing this line to: $result_ex = mysql_query($result) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
primcrew Posted January 26, 2011 Author Share Posted January 26, 2011 sorry to waste peoples time, i found out what was wrong Quote Link to comment Share on other sites More sharing options...
Maq Posted January 26, 2011 Share Posted January 26, 2011 sorry to waste peoples time, i found out what was wrong Do you mind sharing in case some one else runs into a similar problem? Quote Link to comment Share on other sites More sharing options...
primcrew Posted January 26, 2011 Author Share Posted January 26, 2011 it was the "" on my mysql_connect and select db info that was doing it Quote Link to comment 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.