Hi..
I'm having some problem with an if condition when I'm trying to insert data
into a mysql table..
the script works fine with no parse errors..but the table doesn't get
updated like I want it to be..
and i'm almost certain that the code is correct...

Here is part of the script..
I have a form where users can update their setting and also be able to
upload a new picture if they wish
Their information is already stored in a table and I wanted to give them the
possibility to add a new picture
or keep the same old one.
here is the code:

if ($picture == "") {

  $query = "UPDATE authors SET name = '$name', email = '$email', website =
'$website', username = '$username', password = '$password' WHERE username =
'$SESSION_UNAME'";

  $result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

   } else {


 $file_dir = "usergraphics";

 if ( $picture_type == "image/gif" )
  {
 copy ( $picture, "$file_dir/$picture_name") or die ("Couldn't Upload
File");

  }


  $query = "UPDATE authors SET name = '$name', email = '$email', website =
'$website', picture = '$picture_name', username = '$username', password =
'$password' WHERE username = '$SESSION_UNAME'";

  $result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());

    }

When the user update his profile with a new picture, everything is entered
in the database correctly but when he updates his profile and leaves the
picture field blank in order to keep his current picture, the information is
entered correctly in the databse but the old picture is deleted from the
table..
How can I remedy it..?

Thanks

Kind Regards

RRamroop

-----------------------------------------------------------------
Ramroop Ravi
Tel: (230) 7258829
Fax: (230) 3952095
E-mail: [EMAIL PROTECTED]
Website: http://www.imagine-studio.com
Fingerprint: 7400 945A D75D 5F76 E312  F7D4 D5C3 A078 FDEA 2984
Public Key: http://www.imagine-studio.com/pgp/raviramroop.asc


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to