Re: mysql query/$post problem
| From: | Barry | Date: | Mon, 27 Mar 2006 08:33:32 +0000 |
| Subject: | Re: mysql query/$post problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232599@lists.php.net to get a copy of this message | ||
Mark wrote:
I havnt even tried this query but i know its wrong can anyone help! How do you know it's wrong ? O_o
*************************************** <?php include("header.php"); include("connect.php"); $comp_id = $_SESSION['comp_id']; $user_id = $_SESSION['user_id']; // Grab variables and insert into database $avname = $_POST['avname']; $query = "INSERT INTO users AVATARS WHERE id =$user_id '','$avname')"; $query = "INSERT INTO users (AVATARS) VALUES ('$avname') WHERE id = $user_id";This works only if the $avname is a STRING!
mysql_query($query);s ----------------------^This will cause an error. That's why you should test scripts before you post em ...
mysql_close(); include("footer.html"); ?> **********************************
I am trying to insert the value of $avname into the users table, into the avatar field. Yeah seems, so ;)-- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)