Jump to content

PHP Parse error: syntax error, unexpected ')' on line 10


yakoup46

Recommended Posts

Here is my code I cannot find the fu**ing unexpected ')'

Maybe I have just been looking at code to much today but I really don't see it. HELP!

 

<?php

$mysql_host = "mysql6.000webhost.com";

$mysql_database = "a1091112_values";

$mysql_user = "a1091112_values";

$mysql_password = "yakoup46";

 

$con = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die ('Error connecting to mysql');

mysql_select_db($mysql_database);

 

if(isset($_POST['buttonsumofodds']) || $_POST['inputbox1']))

{

$sql="INSERT INTO Sumofodds VALUES ('$_POST[inputbox1]')";

 

if($_POST[inputbox1] != -144)

echo "Sorry Wrong!";

else

echo "Correct!";

}

 

if(isset($_POST['buttonsumofchain']) || $_POST['inputbox3']))

{

$sql="INSERT INTO Sumofchain VALUES ('$_POST[inputbox3]')";

 

if($_POST[inputbox3] != 820)

echo "Sorry Wrong!";

else

echo "Correct!";

}

 

if(isset($_POST['buttonsumofsquares']) || $_POST['inputbox2']))

{

$sql="INSERT INTO Sumofsquares VALUES ('$_POST[inputbox2]')";

 

if($_POST[inputbox2] != 2870)

echo "Sorry Wrong!";

else

echo "Correct!";

}

 

if(isset($_POST['buttonsumofprimes']) || $_POST['inputbox5']))

{

$sql="INSERT INTO Sumofprimes VALUES ('$_POST[inputbox5]')";

 

if($_POST[inputbox5] != 1060)

echo "Sorry Wrong!";

else

echo "Correct!";

}

 

if(isset($_POST['buttonsumofdifference']) || $_POST['inputbox4']))

{

$sql="INSERT INTO Diffofsums VALUES ('$_POST[inputbox4]')";

 

if($_POST[inputbox4] != -144)

echo "Sorry Wrong!";

else

echo "Correct!";

}

 

echo '<br>Redirecting...';

echo '<META HTTP-EQUIV="Refresh" Content="1; URL=http://luta.comuv.com/Easy/easy.html">';

 

if (!mysql_query($sql,$con))

  {

  die('Error: ' . mysql_error());

  }

 

mysql_close($con)

?>

Link to comment
Share on other sites

dude u have a typo error.. :P

 

if(isset($_POST['buttonsumofodds']) || $_POST['inputbox1']))

 

change this to

if(isset($_POST['buttonsumofodds']) || $_POST['inputbox1'])

 

 

and also

if(isset($_POST['buttonsumofchain']) || $_POST['inputbox3']))

 

this too

if(isset($_POST['buttonsumofchain']) || $_POST['inputbox3'])

 

as well as

if(isset($_POST['buttonsumofsquares']) || $_POST['inputbox2']))

these too

if(isset($_POST['buttonsumofsquares']) || $_POST['inputbox2'])

from

if(isset($_POST['buttonsumofprimes']) || $_POST['inputbox5']))

to

if(isset($_POST['buttonsumofprimes']) || $_POST['inputbox5'])

 

from

if(isset($_POST['buttonsumofdifference']) || $_POST['inputbox4']))

to

if(isset($_POST['buttonsumofdifference']) || $_POST['inputbox4'])

Link to comment
Share on other sites

Although I just noticed.

$sql="INSERT INTO Sumofodds VALUES ('$_POST[inputbox1]')";

These aren't qurys, these are strings. Maybe try a format like..

$sql = mysql_query(" blah blah here ");

 

he is running the query at the end..

 

if (!mysql_query($sql,$con))

  {

  die('Error: ' . mysql_error());

  }

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.