4images Forum & Community

General / Allgemeines => Programming => Topic started by: sameerG on April 25, 2009, 09:39:13 AM

Title: Please Help to update table. I have pasted mysql query here..please check
Post by: sameerG on April 25, 2009, 09:39:13 AM
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
Title: Re: Please Help to update table. I have pasted mysql query here..please check
Post by: V@no on April 25, 2009, 07:00:56 PM
The query looks fine, I think, perhaps it's the rest of the code that is wrong?
Title: Re: Please Help to update table. I have pasted mysql query here..please check
Post by: HansBr on May 13, 2009, 02:13:21 PM
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.