General / Allgemeines > Programming

Please Help to update table. I have pasted mysql query here..please check

(1/1)

sameerG:

--- Code: ---$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);
--- End code ---

I have also tried following qury to,


--- Code: ---SET ".get_user_table_field("", "user_name")." = '$user_name'

--- End code ---
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

V@no:
The query looks fine, I think, perhaps it's the rest of the code that is wrong?

HansBr:

--- Quote from: sameerG on April 25, 2009, 09:39:13 AM ---
--- Code: ---$sql = "UPDATE ".USERS_TABLE."
            SET  user_name='$user_name',
--- End code ---

--- End quote ---
Are you shure there are no qutation marks missing? Like
--- Code: ---SET user_name='".$user_name."',
--- End code ---
Edit: Ups, sorry they are not missing. My bad.

Have a look at your query with
--- Code: ---echo $sql;
--- End code ---
.
What does mysql say? For debugging purposes put a

--- Code: ---if (!$result) {
    echo "Database error:".$site_db->error."<br />";
}

--- End code ---
after the query.

Navigation

[0] Message Index

Go to full version