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 Link to comment https://forums.phpfreaks.com/topic/225748-info-doesnt-get-added-to-my-db/ 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()); Link to comment https://forums.phpfreaks.com/topic/225748-info-doesnt-get-added-to-my-db/#findComment-1165517 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 Link to comment https://forums.phpfreaks.com/topic/225748-info-doesnt-get-added-to-my-db/#findComment-1165520 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? Link to comment https://forums.phpfreaks.com/topic/225748-info-doesnt-get-added-to-my-db/#findComment-1165530 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 Link to comment https://forums.phpfreaks.com/topic/225748-info-doesnt-get-added-to-my-db/#findComment-1165535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.