Nexus10 Posted June 21, 2010 Share Posted June 21, 2010 <?php $host = "localhost"; $user = "ericsmi_admin"; $password = "password"; $database = "ericsmi_Users"; mysql_connect($host, $user, $password) or die(mysql_error("DIED")); mysql_select_db($database) or die("Error: Could not connect to database"); $query = INSERT INTO Users(user, date_registered, password, email) VALUES ("eric", "12/12/12, test, eric@eric.com"); mysql_query($query) or die("Error: data not inserted"); echo("Data inserted");?> Nothing happens, nothing is printed, not no error message. Quote Link to comment Share on other sites More sharing options...
phpchamps Posted June 21, 2010 Share Posted June 21, 2010 whats in the view source? Quote Link to comment Share on other sites More sharing options...
Nexus10 Posted June 21, 2010 Author Share Posted June 21, 2010 Still nothing when using the full tag. Quote Link to comment Share on other sites More sharing options...
phpchamps Posted June 21, 2010 Share Posted June 21, 2010 print insert query and try to run it through phpmyadmin Quote Link to comment Share on other sites More sharing options...
Nexus10 Posted June 21, 2010 Author Share Posted June 21, 2010 print insert query and try to run it through phpmyadmin I don't understand (new to PHP)? Quote Link to comment Share on other sites More sharing options...
Nexus10 Posted June 21, 2010 Author Share Posted June 21, 2010 ? Quote Link to comment Share on other sites More sharing options...
phpchamps Posted June 21, 2010 Share Posted June 21, 2010 Try this and tell me whts the output... error_reporting(E_ALL); $host = "localhost"; $user = "ericsmi_admin"; $password = "password"; $database = "ericsmi_Users"; mysql_connect($host, $user, $password) or die(mysql_error("DIED")); mysql_select_db($database) or die("Error: Could not connect to database"); $query = "INSERT INTO Users(user, date_registered, password, email) VALUES ('eric', '12/12/12', 'test', 'eric@eric.com')"; mysql_query($query) or die("Error: data not inserted"); echo("Data inserted"); Quote Link to comment Share on other sites More sharing options...
dabaR Posted June 21, 2010 Share Posted June 21, 2010 $query = INSERT INTO Users(user, date_registered, password, email) VALUES ("eric", "12/12/12, test, eric@eric.com"); There are no quotes around the query string. You need: $query = 'INSERT INTO Users(user, date_registered, password, email) VALUES ("eric", "12/12/12, test, eric@eric.com")'; Quote Link to comment Share on other sites More sharing options...
dabaR Posted June 21, 2010 Share Posted June 21, 2010 Oh, and.... Get into the habit of starting all your scripts with error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
Nexus10 Posted June 21, 2010 Author Share Posted June 21, 2010 Try this and tell me whts the output... Error: data not inserted Quote Link to comment Share on other sites More sharing options...
phpchamps Posted June 21, 2010 Share Posted June 21, 2010 cool now problem is in your insert query... get it right.. simple... Quote Link to comment Share on other sites More sharing options...
Nexus10 Posted June 21, 2010 Author Share Posted June 21, 2010 Thanks, it works now Quote Link to comment Share on other sites More sharing options...
phpchamps Posted June 21, 2010 Share Posted June 21, 2010 cool....mark this post as solved... 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.