Jump to content

Ahhh! Errors!


Zoud

Recommended Posts

[quote]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 'from) VALUES ('blah blah','blah blah','Zoud')' at line 1[/quote]

Here's the page with the error:

[code]<?php require("../../includes/layout_top.php"); ?>

<?php
$con = mysql_connect("-","-","-");
if (!$con)
  {
  die('Error: ' . mysql_error());
  }

mysql_select_db("news", $con);

if(isset($_POST[submit]))  {
$sql="INSERT INTO sitenews (title, info, from) VALUES ('$_POST[title]','$_POST[info]','$_POST[from]')";

if (!mysql_query($sql,$con))
  {
  die('Update was not sent. The error message below was recieved.<br /><br />Error: ' . mysql_error());
  }
  echo "Update has been sent.";
  }
  else  {
  echo "Post update below.<br />";
  echo "<form action='newspost_home.php' method='post'>";
  echo "<br />Username: <input type='text' name='from' />";
  echo "<br />Title: <input type='text' name='title' />";
  echo "<br />Information: <textarea name='info'></textarea>";
  echo "<br /><input type='submit' name='submit' value='Post News!' />";
  echo "</form>";
  }
mysql_close($con)
?>

<?php require("../../includes/layout_bot.php"); ?>[/code]

I have a similar script that enters users into a diffrent DB and it works perfectly. Infact I just copy and pasted the script from that one and altered it into this one. The only diffrences are changes in the form and I added one more row in the INSERT INTO & VALUES.
Link to comment
https://forums.phpfreaks.com/topic/34300-ahhh-errors/
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.