Hello,
I am quite new to PHP but have managed quite well so far, my problem is with the script below. Can anyone help me?
It generates this message:
From this code:Code: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 6
PHP Code:<html>
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF']?>">
<p>Article Name:
<input name="heading" type="text" id="heading" size="50">
</p>
<p>Article Text:
<textarea name="article" cols="100" rows="15" id="article"></textarea>
</p>
<p>Author:
<input name="author" type="text" id="author">
Source:
<input name="source" type="text" id="source">
</p>
<p>
<input type="submit" name="submitnews" value="Submit">
</p>
</form>
<?
// Connecting
$connect = @mysql_connect('localhost', 'root', 'martin');
if (!$connect) {
die( '<p>problem ' . mysql_error() . '</p>');
}
// Select Database
$select = @mysql_select_db('mortgage');
if (!$select) {
die( '<p>problem ' . mysql_error() . '</p>');
}
if (isset($_POST ['submitnews'])) {
$heading = $_POST['heading'];
$article = $_POST['article'];
$author = $_POST['author'];
$source = $_POST['source'];
$sql = "INSERT INTO news SET
heading = '$heading',
article = '$article',
author = '$author',
source = '$source',
articledate = CURRDATE()";
if (@mysql_query($sql)) {
echo('<p>Your article has been submitted</p>');
} else {
echo('<p>Houston We have a problem!' . mysql_error() . '</p>');
}
}
?>
</html>




Bookmarks