Meza44 Posted September 27, 2006 Share Posted September 27, 2006 I am new to PHP and Mysql I am getting an error from a piece of code that I copied from a tutorial and don't know how to fix it.Here is the errorParse error: parse error, unexpected ',' in /home/content/i/b/e/ibezamn/html/insert.php on line 21Here is my code<html><head><title>Insert.PHP</title></head><body><?include("/php/capsroster.inc.php");$first=$_POST['first'];$last=$_POST['last'];$number=$_POST['number'];$position=$_POST['position'];$height=$_POST['height'];$weight=$_POST['weight'];$shoots=$_POST['shoots'];$dob=$_POST['dob'];mysql_connect(mysql213.secureserver.net,$username,$password);@mysql_select_db($database) or die("Unable to select database");$query="INSERT INTO roster VALUES(",'$first','$last','$number','$position','$height','$weight','$shoots','$dob')";mysql_query($query);mysql_close();?><a href="websiteinputform2.html">Add another player</a></body></html>Thank you Quote Link to comment https://forums.phpfreaks.com/topic/22234-php-error/ Share on other sites More sharing options...
wildteen88 Posted September 27, 2006 Share Posted September 27, 2006 You had double quote (maked in red) in your query. Which was breaking the string. And thus you got the error.[quote]$query="INSERT INTO roster VALUES([color=red][b]"[/b][/color],'$first','$last','$number','$position','$height','$weight','$shoots','$dob')";[/quote]use this instead:[code=php:0]$query="INSERT INTO roster VALUES(NULL,'$first','$last','$number','$position','$height','$weight','$shoots','$dob')";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22234-php-error/#findComment-99528 Share on other sites More sharing options...
Meza44 Posted September 27, 2006 Author Share Posted September 27, 2006 thank you Quote Link to comment https://forums.phpfreaks.com/topic/22234-php-error/#findComment-99612 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.