php - Struggling to get this to upload into my database -


// check status. if (!empty($_session[username])) { echo "hi, <b>$_session[username]</b>.";  if ($_post['submit']) {      //get file attributes     $name = $_files['myfile']['name'];     $tmp_name = $_files['myfile']['tmp_name'];  if ($name) {     //start upload process      $location = "avatars/$name";     move_uploaded_file($tmp_name,$location);          $query = mysql_query("update members set imagelocation='$location' username='$username'");          die("your image has been uploaded! <a href='dashboard.php'>back</a>");   } else die("please select file"); } echo "upload image:  <form action='profile.php' method='post' enctype='multipart/formdata'>  file: <input type='file' name='myfile'> <input type='submit' name='submit' value='upload'></form>";  } 

its showing username fine, have correct tables , columns in db when hit upload nothing?

you can see logging in username: test password: test url: learning.iamdanbarrett.com

i think there problem in query

$query = mysql_query("update members set imagelocation='$location' username='$username'"); 

because not defining $username variable anywhere in script hence, query checking like

update members set imagelocation='$location' username =''; 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -