topshelfbleu Posted April 19, 2010 Share Posted April 19, 2010 I've been looking at this for over an hour- I've even opened a book. I'm totally new to it and trying to write a form which allow friends to post predictions for each world cup match. Is there anything that stands out to you here. Once clicking submit - the retrieving page isn't showing anything and obv not submitting to the dbase. <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("aaworldcup", $con); $Name =$_POST['Name']; $email =$_POST['email'}; $m1hscore =$_POST['m1hscore']; $m1ascore =$_POST['m1ascore']; $enter_sql= "INSERT INTO aaworldcup (Name,email,m1hscore,m1ascore) VALUES ('$Name','$email','$m1hscore','$m1ascore')"; $enter_query =mysql_query($enter)sql) or die (mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 19, 2010 Share Posted April 19, 2010 Your code contains a fatal parse error because of a mistyped under-score _ in the following line - Parse error: syntax error, unexpected '}', expecting ']' in your_file.php on line 11 You should be learning php, developing php code, or debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you. You will save a ton of time. Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/#findComment-1044880 Share on other sites More sharing options...
hcdarkmage Posted April 19, 2010 Share Posted April 19, 2010 I've been looking at this for over an hour- I've even opened a book. I'm totally new to it and trying to write a form which allow friends to post predictions for each world cup match. Is there anything that stands out to you here. Once clicking submit - the retrieving page isn't showing anything and obv not submitting to the dbase. <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("aaworldcup", $con); $Name =$_POST['Name']; $email =$_POST['email'}; //<---- Here is your problem $m1hscore =$_POST['m1hscore']; $m1ascore =$_POST['m1ascore']; $enter_sql= "INSERT INTO aaworldcup (Name,email,m1hscore,m1ascore) VALUES ('$Name','$email','$m1hscore','$m1ascore')"; $enter_query =mysql_query($enter)sql) or die (mysql_error()); ?> I commented the code where your problem is. Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/#findComment-1044881 Share on other sites More sharing options...
topshelfbleu Posted April 19, 2010 Author Share Posted April 19, 2010 thanks all- but still nothing appearing. (I have corrected the straight bracket). I've been typing into dw rather than use a debugging tool. Am just having a look now at netbeans the post form is http://www.candango.co.uk/php/insert_records.php code for entry_page.php is <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("aaworldcup", $con); $Name =$_POST['Name']; $email =$_POST['email']; $m1hscore =$_POST['m1hscore']; $m1ascore =$_POST['m1ascore']; $enter_sql= "INSERT INTO aaworldcup (Name,email,m1hscore,m1ascore) VALUES ('$Name','$email','$m1hscore','$m1ascore')"; $enter_query =mysql_query($enter)sql) or die (mysql_error()); ?> <body> hello</body> Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/#findComment-1044889 Share on other sites More sharing options...
PFMaBiSmAd Posted April 20, 2010 Share Posted April 20, 2010 The line that hcdarkmage pointed out was actually the cause of the error message I posted. The under-score problem I mentioned is what I saw by looking at the code and it is still present and is causing a fatal parse error. Until you do this - You should be learning php, developing php code, or debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you. you will be doomed to spend hours finding simple problems that will take a few seconds to find and fix when php helps by reporting and displaying all the errors it detects. Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/#findComment-1044920 Share on other sites More sharing options...
-Karl- Posted April 20, 2010 Share Posted April 20, 2010 $enter_query =mysql_query($enter)sql) or die (mysql_error()); $enter_query =mysql_query($enter_sql) or die (mysql_error()); See the difference? Bottom is correct. Which is what PFMaBiSmAd was trying to say to you, rather than just pointing it out. Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/#findComment-1044923 Share on other sites More sharing options...
topshelfbleu Posted April 20, 2010 Author Share Posted April 20, 2010 Yep - I do see the difference.... and thanks for pointing out that particular issue. However... I'm embarrassed to say I don't know what PFMaBiSmAd's s quote "debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you" actually means. Quote Link to comment https://forums.phpfreaks.com/topic/199068-posting-into-mysql-am-looking-at-a-blank-page/#findComment-1045053 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.