Jump to content

Posting into Mysql--am looking at a blank page.


topshelfbleu

Recommended Posts

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());
?>

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.

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.

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>

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.

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. 

 

:-[

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.