eciym Posted February 23, 2007 Share Posted February 23, 2007 Hi I have this very simple form, and want it to insert some data in to some field. Very simple you might think however after following the step by step functions a gazillion times it still doesn't work. I get no error message, it prints the variables before the insert query and prints the text "Records added to the database" after it is supposed to be inserted. But the table remain empty... it's beaten me and now I implore the help of somebody who knows what they are doing. <?php mysql_connect("localhost", "usr", "pwd") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); ?> ... <?php print $erbjmarke; print $erbjartikel ; print $erbjxpris ; print $erbjordpris ; $query = "INSERT INTO erbjudan (erbjmarke, erbjartikel, erbjxpris, erbjordpris) VALUES ('$erbjmarke','$erbjartikel','$erbjxpris','$erbjordpris')"; print "Records added to the database"; ?> Thank you in anticipation Quote Link to comment https://forums.phpfreaks.com/topic/39770-data-doesnt-enter-table-mysql/ Share on other sites More sharing options...
paul2463 Posted February 23, 2007 Share Posted February 23, 2007 missing execution line try this <?php mysql_connect("localhost", "usr", "pwd") or die(mysql_error()); mysql_select_db("dbname") or die(mysql_error()); ?> ... <?php print $erbjmarke; print $erbjartikel ; print $erbjxpris ; print $erbjordpris ; $query = "INSERT INTO erbjudan (erbjmarke, erbjartikel, erbjxpris, erbjordpris) VALUES ('$erbjmarke','$erbjartikel','$erbjxpris','$erbjordpris')"; //this line was missing mysql_query($query) or die ('Error in query: $query. ' . mysql_error()); print "Records added to the database"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/39770-data-doesnt-enter-table-mysql/#findComment-192054 Share on other sites More sharing options...
eciym Posted February 23, 2007 Author Share Posted February 23, 2007 thank you. now i can stop aggravating my forming stomach ulcer. looks like i have a lot of learning to do. Quote Link to comment https://forums.phpfreaks.com/topic/39770-data-doesnt-enter-table-mysql/#findComment-192099 Share on other sites More sharing options...
weknowtheworld Posted February 23, 2007 Share Posted February 23, 2007 Do visit php.net for more learning in php. Happy learning.... Quote Link to comment https://forums.phpfreaks.com/topic/39770-data-doesnt-enter-table-mysql/#findComment-192317 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.