2017-01-29 43 views
-2

我是新手,還在學習php。我試圖運行一些mysqli_query,但它給了我一些錯誤。我的代碼如下所示。mysqli_query出錯了

<?php 
 
ob_start(); 
 
include("db.php"); 
 
$result = mysqli_query($conn,"SELECT * FROM contest"); 
 
    while($row = $result->fetch_assoc()){ 
 
     if($row['automated'] ==1){ 
 
      echo 'Atomatic is enabled'; 
 
      $result1 = mysqli_query($conn,"UPDATE `contest` SET automated =0" 
 
    \t $new = mysqli_query($conn,$result1); 
 
    \t echo 'Atomatic is Disabled'; 
 
     } 
 
     else{ 
 
      echo 'Atomatic is Disabled'; 
 
     } 
 
    }

有人可以檢查並請建議我什麼是錯在此查詢?它給我錯誤,如解析錯誤:語法錯誤,意想不到的'新'和類似的,如果我改變它。謝謝

回答

1

關閉patenthesis。 () ..

$result1 = mysqli_query($conn,"UPDATE `contest` SET automated =0");//error was here 
+0

謝謝...它工作正常:) –

+0

巨峯高興help.feel免費接受answer.thanks –

+0

我不能做到這一點,現在....它給錯誤,我將能夠在10分鐘內接受答案...我會在幾分鐘內完成 –