Hi guys, i was trying this tutorial and there is this code which i try to use:
"
<?php
if (isset($_POST["submit"]))
{
require('/home/name/folder/sql_connect.inc');
$title = $POST['title'];
$entry = $POST['entry'];
$user = $_POST['user'];
//Trims the values to clean up the text
trim ($title);
trim ($entry);
trim ($user);
//adding in escape characters for the query
$title = addslashes ($title);
$entry = addslashes ($entry);
$user = addslashes ($user);
//define the query
$query = "INSERT INTO blog_entries(id, title, entry, date_entered, user)
VALUES (0, '$title', '$entry', UNIX_TIMESTAMP(), '$user')";
//executes the query
if (@ ($query)) {
?>
<center>The event was successfully saved.
<a href="index.php">Return to administrative
page</a></center>
<?php
}
else {
?>
<center>The event could not be saved.
<a href="index.php">Return to administrative
page</a></center>
<?php
}
mysql_close(); //Closes our SQL session
}
else {
?>
<center>There is no data to process.
<a href="index.php">Return to administrative
page</a></center>
}
"
When i click on the button that activates this script. I got the error
Parse error: parse error, unexpected $ in /home/user/folder/add.php on line 54
By Pasre error it means that it's definitely a syntax error? Can it be a connection error in the first place?
anyone help a newbie with this? I've tried altering the structure abit but still can't get it.
Thanks for any help in advance