PDA

View Full Version : What is wrong?


vietkieu_cz
10-29-2006, 08:16 PM
I tried this code, I don't know why it shows some errors.

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 '1' at line 1

and how to do, when it runs sucessfull and automaticality return to $_REQUEST['do'] == "add" ???
// ### ADD ###
if ($_REQUEST['do'] == "add")
{
echo "<table border=\"1\" align=\"center\">
<tr>
<td><form action=\"$PHP_SELF?do=adding\" method=\"post\">
Title:<br/> <small>Example: American Pie 4</small></td>
<td><input type=\"text\" name=\"title\" value=\"Title\" onfocus=\"if (this.value == 'Title') this.value = '';\"/></td>
</tr>
<tr>
<td>If you're done, click Send!
<td><input type=\"submit\" value=\"Send\"/></form></td>
</tr>
</table>

";
}

// ### START ADDING ###
if ($_REQUEST['do'] == "adding")
{
$adding = $db->query("
INSERT INTO test (title)
VALUES ('$_POST[title]')
");
}

sebbe
10-29-2006, 09:13 PM
What happens if you remove the OnFocus attribute?

Also to to return, try this
header("Location: $PHP_SELF?do=add");
I'm not sure if this will work though, but you can give it a try?

vietkieu_cz
10-30-2006, 06:57 AM
It doesn't work :(