GUYS I know you are trying to help me and its annoying to keep asking. Anyway, I am only a week old where php is concerned so if I seem a little confused please bear with me. The last 3 reply to my question didn't help much .The first from gloveny didn't do anything when i inserted it...the second from mjdamato was good but it kept inserting a new record instead of replacing the one thats already there. And the third from mpharo kept giving me a Parse error, unexpected T_VARIABLE in...
Ok guys let me explain again what i want to do. The table should contain one record. The query should check to see if there is a record. If there is one then its updated, if not then one is added. The key for that table is heading. Here is the original code again guys. (Oh by the way I did not write this code i am only trying to modify it) :-) thanks.
<?php
if(isset($_POST['save']))
{
$heading = $_POST['heading'];
$updates = $_POST['updates'];
if(!get_magic_quotes_gpc())
{
$heading = addslashes($heading);
$updates = addslashes($updates);
}
$query = " INSERT INTO news (heading, updates) ".
" VALUES ('$heading', '$updates')";
mysql_query($query) or die('Error ,query failed');
include 'library/closedb.php';
echo "Update '$heading' added";
}
?>