Jump to content

Add News


Joshua F

Recommended Posts

I have this code..

<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
mysql_query("INSERT INTO blog (date, name, desc) VALUES ('" . date("Y-m-d") . "', '". realEscape($_POST['name']) ."', '". realEscape($_POST['desc']) ."')  ") or die(mysql_error());
echo "News Added.";
}
?>
<center><h1>Adding News</h1>
<form action="news.php" method="POST">
Your News Name:<br>
<input id="name" type="text" name="name" autocomplete="off" maxlength="25"><br>Your News Description: <br>
<textarea name="desc" id="desc" rows="3" cols="60" maxlength="250"> </textarea><br>
<input type="submit" name="submit" value="Add News">
</form>

 

And the error is

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 'desc) VALUES ('2010-09-02', 'vcv', ' xcvxc')' at line 1

 

Note: vcv and xcvxc are the inputs we(I) used for a test so we(I) could get the error.

Link to comment
https://forums.phpfreaks.com/topic/212404-add-news/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.