• Please Help to update table. I have pasted mysql query here..please check 5 0 5 1
Currently:  

Author Topic: Please Help to update table. I have pasted mysql query here..please check  (Read 7844 times)

0 Members and 1 Guest are viewing this topic.

Offline sameerG

  • Pre-Newbie
  • Posts: 5
    • View Profile
Code: [Select]
$sql = "UPDATE ".USERS_TABLE."
            SET  user_name='$user_name',user_country='".$user_info['user_country']."',user_state='".$user_info['user_state']."',user_address='".$user_info['user_address']."',user_phone='".$user_info['user_phone']."',user_fax='".$user_info['user_fax']."',user_web='".$user_info['user_web']."',user_mod_height='".$user_info['user_mod_height']."',user_mod_weight='".$user_info['user_mod_weight']."',user_mod_waist='".$user_info['user_mod_waist']."',user_mod_hips='".$user_info['user_mod_hips']."',user_mod_chest='".$user_info['user_mod_chest']."',user_fashion_is='".$user_info['user_fashion_is']."',user_fashion_in='".$user_info['user_fashion_in']."',user_workexp='".$user_info['user_workexp']."',user_achiv='".$user_info['user_achiv']."',user_goal='".$user_info['user_goal']."'
where user_id=".$user_info['user_id'];
     $result=$site_db->query($sql);

I have also tried following qury to,

Code: [Select]
SET ".get_user_table_field("", "user_name")." = '$user_name'
but it cant work,

it replaces null in place of variables name.  So please help me I completely new to using PHP and also 4images too.

Thanks in advance
« Last Edit: April 25, 2009, 06:59:07 PM by V@no »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
The query looks fine, I think, perhaps it's the rest of the code that is wrong?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline HansBr

  • Pre-Newbie
  • Posts: 7
    • View Profile
Code: [Select]
$sql = "UPDATE ".USERS_TABLE."
            SET  user_name='$user_name',
Are you shure there are no qutation marks missing? Like
Code: [Select]
SET user_name='".$user_name."',Edit: Ups, sorry they are not missing. My bad.

Have a look at your query with
Code: [Select]
echo $sql;.
What does mysql say? For debugging purposes put a
Code: [Select]
if (!$result) {
    echo "Database error:".$site_db->error."<br />";
}
after the query.
« Last Edit: May 13, 2009, 04:03:37 PM by V@no »