Small Parse Error; unexpected T_variable

Hey guys, I’m not new to the PHP coding scene, but I’m not completely fluent in all the workings of the code. I’m hoping someone can help me out with this small issue.

I’m making a website for my school’s baseball team. One of the features I added was a news article system where the school could submit an article to the site, have it show up on the front page, and also have the articles stored in an archive.

The code below is from the article submit where its pulling the info from the article form on the previous page.

Parse error: parse error, unexpected T_VARIABLE in /var/www/html/pfhs/baseball/art_post.php on line 3

<?PHP include ('dbconnect.php') $result = mysql_query("SELECT * FROM pf_articles") or die (mysql_error()); $row = mysql_fetch_array($result); $check = "INSERT INTO pf_articles () values ()"; if ($row["art_id"] == NULL) { mysql_query($check) or die (mysql_error()); } else {} //Add article data to database. if ($submit == "Post Article") { $query = "insert into pf_articles (art_title,art_writer,art_date,are_content,art_img) values ('$art_title','$art_writer','$art_date', '$art_content', '$art_img')" ; mysql_query($query) or die (mysql_error()); ?>

If someone could please check this out I’d really appreciate it. This website is due to be completed very soon and my holiday break was very hectic! Thank you in advance.

Hey guys, I'm not new to the PHP coding scene, but I'm not completely fluent in all the workings of the code. I'm hoping someone can help me out with this small issue.

I’m making a website for my school’s baseball team. One of the features I added was a news article system where the school could submit an article to the site, have it show up on the front page, and also have the articles stored in an archive.

The code below is from the article submit where its pulling the info from the article form on the previous page.

Parse error: parse error, unexpected T_VARIABLE in /var/www/html/pfhs/baseball/art_post.php on line 3

[php]

<?PHP include ('dbconnect.php') $result = mysql_query("SELECT * FROM pf_articles") or die (mysql_error()); $row = mysql_fetch_array($result); $check = "INSERT INTO pf_articles () values ()"; if ($row["art_id"] == NULL) { mysql_query($check) or die (mysql_error()); } else {} //Add article data to database. if ($submit == "Post Article") { $query = "insert into pf_articles (art_title,art_writer,art_date,are_content,art_img) values ('$art_title','$art_writer','$art_date', '$art_content', '$art_img')" ; mysql_query($query) or die (mysql_error()); ?>

[/php]
If someone could please check this out I’d really appreciate it. This website is due to be completed very soon and my holiday break was very hectic! Thank you in advance.


You forgot to put a semicolon after the statement include. Usually anything that’s unexpected means that you haven’t successfully ended a statement. Recheck your scripts and make sure all the necessary semicolons are there.
Sponsor our Newsletter | Privacy Policy | Terms of Service