I keep getting this error on my script!!!!

Please help me. I’ve got this script and I keep getting errors every time it tries to execute. I would really appreciate your help.

Here is the error:Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 10

Here is the script:

<?php include('dbconnect.php'); ?> <?php $membername=$_POST['membername']; if(isset($_POST['username']) and $_POST['username']!=""){ $sponsorid=$_SESSION['memberid_for_sp']; }else{ $sponsorid=0; } $dateofjoining=date("Y-m-d");; $address=$_POST['address']; $city=$_POST['city']; $state=$_POST['state']; $country=$_POST['country']; $mobileno=$_POST['mobileno']; $countrycode=$_POST['countrycode']; $dateofbirth=$_POST['dateofbirth']; $emailid=$_POST['emailid']; $myid=$_SESSION['memberid']; $sql="UPDATE personal SET membername='$membername', sponsorid='$sponsorid', dateofjoining='$dateofjoining', address='$address', city='$city', state='$state', country='$country', mobileno='$mobileno', countrycode='$countrycode', dateofbirth='$dateofbirth', emailid='$emailid' WHERE memberid=$myid"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 record added"; header('Location: coapp.php?msg=1'); //return $frmdetail.php; ?>

Thank you so much for all of your help!

Eric

remove the extra ; from this line

[php]
$dateofjoining=date(“Y-m-d”);;
[/php]

That extra ; should not be an issue with the SQL syntax…

You are however missing the ‘’ around $myid in the final line of the sql statement.

it reads [php]dateofbirth=’$dateofbirth’, emailid=’$emailid’ WHERE memberid=$myid";
[/php]

it should read [php]dateofbirth=’$dateofbirth’, emailid=’$emailid’ WHERE memberid=’$myid’";
[/php]

had you posted your code in the code block this site offers you would have noticed it right away

Sponsor our Newsletter | Privacy Policy | Terms of Service