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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

$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.

Link to comment
Share on other sites

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. 

 

:-[

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.