Re: mysql query/$post problem

From: Date: Mon, 27 Mar 2006 12:29:23 +0000
Subject: Re: mysql query/$post problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-232602@lists.php.net to get a copy of this message
PHP Mailer wrote:
Mark skrev: [snip]
$query = "INSERT INTO users AVATARS WHERE id =$user_id '','$avname')"; mysql_query($query);s [snip]
I am trying to insert the value of $avname into the users table, into the avatar field.
I think what you are trying to do is coordinated a bit wrong, perhaps http://www.w3schools.com/sql/sql_insert.asp could be of some help for you to achieve this in the future. Taking a look at your query, i do see what you are trying to do, but the structure is wrong. $query = "INSERT INTO users (avatars) VALUES ('$avname')WHERE id ='$user_id')";
Also - it looks like an UPDATE might be more suitable for what you want, given that you've got a WHERE clause tacked on the end. Google for a good SQL tutorial; the PHP mailing list is not the place to learn SQL :) Jasper

« previous php.general (#232602) next »