i'm scratching head, because can't figure out what's wrong code below.. $avatar_path not saved mysql table..
<?php $avatar_path = $mysqli->real_escape_string('images/'.$_files['avatar']['name']); //check if file type image if (preg_match("!image!",$_files['avatar']['type'])) { //copy image images/ folder if (copy($_files['avatar']['tmp_name'], $avatar_path)){ //set session variables display on welcome page $_session['username'] = $username; $_session['avatar'] = $avatar_path; //insert user data database $update_row = $mysqli->query("update user_data set avatar='$avatar_path' user_id='1'") or die($mysqli->error()); } } ?>
could try ?
$update_row = $mysqli->query("update user_data set avatar='$avatar_path' user_id=1") or die($mysqli->error());
(i.e. suppress quotes around id value)* quotes not necessary around integers , possibly mess making mysql take string.
Comments
Post a Comment