Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
goblinhybrid
- Forum Newbie
- Posts: 8
- Joined: Tue Dec 09, 2003 2:41 pm
Post
by goblinhybrid »
Here is my code. It says there is a parse error around line 20 but im not experienced to enough to see it.
Code: Select all
<?php
$datetime = date("m.d.y\ H:i:s");
$Location = $_POST['Location'];
$Area = $_POST['Area'];
$Title = $_POST['Title'];
$Author = $_POST['Author'];
$Data = $_POST['Data'];
echo $Area;
$dbh=mysql_connect ("localhost", "xskate_reviews", "password") or die ('There was an error with the database: ' . mysql_error());
mysql_select_db ("xskate_reviews");
if ($Area == "Parks")
{
$query = "INSERT INTO `Parks` VALUES ('', '$Title', '$Location', '$Author', '$Data', NOW( ));"
}
if ($Area == "Street")
{
$query = "INSERT INTO `Street` VALUES ('', '$Title', '$Location', '$Author', '$Data', NOW( ));"
}
if ($Area == "Tricks")
{
$query = "INSERT INTO `Tricks` VALUES ('', '$Title', '$Author', '$Data', NOW( ) );"
}
mysql_query($query);
mysql_close();
?>
Cheers
-
andre_c
- Forum Contributor
- Posts: 412
- Joined: Sun Feb 29, 2004 6:49 pm
- Location: Salt Lake City, Utah
Post
by andre_c »
the semicolon needs to be at the end of the line (after the closing double quotes) on each of the queries
-
Weirdan
- Moderator
- Posts: 5978
- Joined: Mon Nov 03, 2003 6:13 pm
- Location: Odessa, Ukraine
Post
by Weirdan »
place the semicolon after the closing quote in all of that lines:
Code: Select all
$query = "INSERT INTO `Parks` VALUES ('', '$Title', '$Location', '$Author', '$Data', NOW( ));"
//should be
$query = "INSERT INTO `Parks` VALUES ('', '$Title', '$Location', '$Author', '$Data', NOW( ))";