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
https://forums.phpfreaks.com/topic/172304-solved-update-in-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.