0
我有一個mysql表,列:name,active(active is int)。我想將圖片上傳到服務器,當它們已經在服務器上時,我想讓它們處於活動狀態,以便將它們用作新的標誌。 (當活動= 1,圖片是新的標誌)我不明白爲什麼我的「$查詢」不起作用。其他一切正常。mysql/php更新語法,傳遞php變量
$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";}