I have a mysql table with columns: name, active (active is int). I want to upload pictures to the server, and when they are already on the server, I want to make them as active so that they are used as the new logo. (when active = 1, the pic is the new logo) I can’t figure out why my “$query” doesn’t work. Everything else works fine.
$name = $_FILES["file"]["name"];
if (file_exists("/home/a1829256/public_html/admin/logo/" .$name)){ //if file already on the server
echo "file is already on the server";
echo ". Making it the new logo";
$deselectlogo = "UPDATE newlogo SET active=0 WHERE active>0"; //deselect old
$deselectlogoResult = mysql_query($deselectlogo);
$query = ("UPDATE newlogo SET active=1 WHERE name=" .$name); // make the new logo active
$queryResult = mysql_query($query);
if (!$queryResult){echo "error";}
if ($queryResult){echo "success";}
1 Answer