i have this code snippet:

  if(isset($_POST['save'])){
  $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].',
'.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\',
'.$_POST['cat'].', \''.$_POST['text'].'\', 0)';
  $result = mysql_query($query) or die("Query failed: $query<br>" .
mysql_error());
    echo 'you saved your work.';
  } elseif(isset($_POST['pub'])) {
    $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].',
'.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\',
'.$_POST['cat'].', \''.nl2br($_POST['text']).'\', 0)';
echo 'you published your work.';
 }

Which has a save or a publish option. I only want to keep one copy of each
article in the DB. This adds a new one each time. I know about updates in
SQL but the file may or may not already be in the db. Does anyone have a
good way to go about this?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to