Jump to content

databse problem


matthew798

Recommended Posts

Hey guys

 

Sweet and simple, here it is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body bgcolor="black">

<table width="696" border="0">
  <tr>
    <td><form action="newsprocess.php" method="POST">
      <input name="title" type="text" width="200px" /></input>
      <br />
      <br />
      <input name="body" type="text" width="400px" height="300px" /></input>
      <input type="submit" /></input>
    </form></td>
    <td valign="top"><strong>To insert an image: The image must be hosted on the internet, I.E. located at an HTTP address</strong></td>
  </tr>
</table>

</body>
</html>

<?php
$body = $_POST['body'];
$title = $_POST['title'];


mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";

mysql_query("INSERT INTO news 
(`title`, `body`, `date`) VALUES ( $title, $body, now())")  
or die(mysql_error());   

echo "Data Inserted!";
?>

 

Why am i geting this when i enter hello in both text fields:Unknown column 'Hello' in 'field list'

Link to comment
https://forums.phpfreaks.com/topic/123472-databse-problem/
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.