2015-10-18 119 views
-4

你好,我有一個循環回聲,我用它來獲得一些MySQL數據庫信息,它工作正常,我做了更新按鈕,它的工作原理,但我在回聲' 「;在刪除href,我嘗試onclick ="return confirm ('Are you sure?')",但它不工作,因爲回聲使用''所以我我('你確定')它不會工作,並會給錯誤因爲它擾亂回聲,所以唯一的辦法是使它(「你確定」)但它不起作用,我需要任何人來幫助我解決它。回聲+確認不工作,

p.s:代碼在另一個模板中工作,但不在回顯中。單引號前

echo' 
          <tr> 
          <td>'.$row["news_id"].'</td> 
          <td>&nbsp;&nbsp;'.$row["title"].'</td> 
          <td>&nbsp;&nbsp; '.htmlentities($content).' </td> 
          <td>&nbsp;&nbsp;'.$row["disable"].'</td> 
          <td>'.$row["created_date"].'</td> 
          <td> 
           <div class="btn-group"> 
            <a class="btn btn-primary" href="#"><i class="icon_plus_alt2"></i></a> 
            <a class="btn btn-success" href="'.site_name.'admin/pages/updatenews.php?nid='.$row["news_id"].'"><i class="icon_check_alt2"></i></a> 
            <a class="btn btn-danger" href="'.site_name.'admin/pages/deletenews.php?nid='.$row["news_id"].'"><i class="icon_close_alt2"></i></a> 
           </div> 
           </td> 
          </tr> '; 
+4

http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single -quoted-and-double-quoted-strings-in-php – Berriel

+1

請閱讀[**如何在此提問**](http://stackoverflow.com/questions/how-to-ask)。句子很有幫助。 –

回答

0

使用反斜槓, 這樣的事情應該工作:

onclick ="return confirm (\'Are you sure?\')"