SQL syntax problem
Posted: Fri Aug 19, 2005 1:39 pm
I made a poetry script and started adding the submit script so users can add there poems and well i keep coming up with this error....
poempost.php
poemsubmit.php
Can someone help please
Thanx
Smackie
here is the two scriptsYou 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 2
poempost.php
Code: Select all
<?php
if (($_SESSION['user_level'] == 1) || ($_SESSION['user_level'] == 2) || ($_SESSION['user_level'] == 3) || ($_SESSION['user_level'] == 4) || ($_SESSION['user_level'] == 5)) {
echo '<div align="center">
<form name="poemscript" method="post" action="../index.php?pages=poemsubmit">
<table width="25%" border="0" cellpadding="4" cellspacing="0" bordercolor="#3399CC">
<tr>
<td width="12%" class="txt"><div align="right">Name:</div></td>
<td width="88%"class="txt"><b>'.$_SESSION['user_name'].'</b><input name="name" type="hidden" value="'.$_SESSION['user_name'].'"></td>
</tr>
<tr>
<td ><font color="red">*</font></td>
<td ><div align="right" class="txt">Poem Name:</div></td>
<td><input name="poemname" type="text" value="" size="30" maxlength="100" class="input-box"></td>
</tr>
<tr>
<td ><font color="red">*</font></td>
<td ><div align="right" class="txt">Poem:</div></td>
<td><textarea name="poem" cols="50" rows="5" id="message" class="input-box"></textarea></td>
</tr>
<tr>
<td> </td>
<td><div align="right"><input name="poempost" type="submit" id="poempost" value="post" class="submit-button"></div></td>
</tr>
</table>';
}
?>Code: Select all
<?php
$user_name = $_POST['user_name'];
$poemname = $_POST['poemname'];
$poem = $_POST['poem'];
if ((!$poemname) || (!$poem)){
echo '<center><font size="1" face="tahoma" color="red"><b>Error!</b> Fields marked * are required to continue.</font></center><br>';
require 'Poem/poempost.php';
return;
}
echo '<center><font class="txt">Thank you for submitting your poem at hauntedgraveyard.net....</font></center>';
$sql = mysql_query("INSERT INTO poems (user_name, poemname, poem)
VALUES('$user_name', '$poemname', '$poem'())") or die (mysql_error());
if (!$sql) {
echo '<center><font class="txt">There has been an error creating your account. Please contact the webmaster.</font></center>';
}
?>Can someone help please
Thanx
Smackie