我有一个带有列的 mysql 表:名称,活动(活动是 int)。我想将图片上传到服务器,当它们已经在服务器上时,我想让它们处于活动状态,以便它们用作新徽标。(当 active = 1 时,图片是新徽标)我无法弄清楚为什么我的“$query”不起作用。其他一切正常。
$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";}