Jump to content

[SOLVED] update in database


MDanz

Recommended Posts

session_start();
$username1 = $_SESSION['username'];
// set them to your login information.
$username = "Master";
$password = "password";
$host = "localhost";
$database = "db";

// Make the connect to MySQL or die
// and display an error.
$link = mysql_connect($host, $username, $password);
if (!$link) {
    die('Could not connect: ' . mysql_error());
}

// Select your database
$image = mysql_real_escape_string($_POST['image']);
       
       $query= mysql_query("UPDATE Reply SET image=$image WHERE username=$username1");
       
       if($query)
       {
         
       print "<br><font color=white>Your avatar has been set.  <a href='member.php'>Return to Upload Page</a></font>"; }
else {
print "No image selected/uploaded";
}

 

Where am i going wrong?  its not uploading to mysql.  I want it to update all rows where username = $username1, with $image for the image field.

 

Its not working so mine obviously not right...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.