[SOLVED] Another DB Problem with update

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
AlbinoJellyfish
Forum Commoner
Posts: 76
Joined: Sun Apr 04, 2004 7:39 pm

[SOLVED] Another DB Problem with update

Post 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);
?>
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

there's no such syntax: UPDATE table (columns,...) values(values,...)
read this page: http://dev.mysql.com/doc/mysql/en/UPDATE.html
AlbinoJellyfish
Forum Commoner
Posts: 76
Joined: Sun Apr 04, 2004 7:39 pm

Post by AlbinoJellyfish »

thank you, i used the commented out one, but acidentally deleted the SET
Post Reply