Page 1 of 1

[SOLVED] Another DB Problem with update

Posted: Wed Aug 11, 2004 4:58 pm
by AlbinoJellyfish
This doesnt even update any information.

Code: Select all

<?php
error_reporting(E_ALL);
$id=$_POST['id'];
$description=$_POST['name'];
$select=$_POST['select'];
$author=$_POST['author'];
$story=$_POST['story'];
$pic = $_POST['pic'];
echo $description;
echo $select;
echo $author;
echo $story;
echo $pic;
echo '<br>';
echo $id;
$db = mysql_connect("localhost","sevengfx","du3452"); 
mysql_select_db("sevengfx_com_-_hosted" , $db) or die("Couldn't open $db: ".mysql_error()); 

mysql_query("UPDATE joe_preview (name,pic,author,story,type) VALUES ('$description','$pic','$author','$story','$select') WHERE id='$id'");
//mysql_query("UPDATE joe_preview ,name='$description', author='$author', story='$story', pic='$pic', type='$select' WHERE id='$id'");
echo "News Updated<br>";
echo '<a href="../index.html">Click here to Continue</a>';
mysql_close($db);
?>

Posted: Wed Aug 11, 2004 5:00 pm
by Weirdan
there's no such syntax: UPDATE table (columns,...) values(values,...)
read this page: http://dev.mysql.com/doc/mysql/en/UPDATE.html

Posted: Wed Aug 11, 2004 5:05 pm
by AlbinoJellyfish
thank you, i used the commented out one, but acidentally deleted the SET