看板 Database 關於我們 聯絡資訊
phpmyadmin可執行下列SQL查詢 update history set comment=concat(comment,'<a href="detail" target="_blank"> 查詢流程</a>') WHERE `status_id`=1 and comment LIKE '%結果 : Succeeded.%' and `date_added`>= curdate() 但相同語法置於.php執行會出現錯誤 <?php $username="username"; $password="password"; $dbname="database"; $dbhost="localhost"; $query="update history set comment=concat(comment,'<a href="detail" target ="_blank">查詢流程</a>') WHERE `status_id`=1 and comment LIKE '%結果 : Succeeded.%' and `date_added`>= curdate()"; mysql_connect($dbhost,$username,$password); @mysql_select_db($dbname) or die(strftime('%c')." Unable to select database"); mysql_query($query); mysql_close(); echo strftime('%c')." ok!"; ?> 還請各位版大指教~感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.74.64.49 ※ 文章網址: https://www.ptt.cc/bbs/Database/M.1513418170.A.525.html
liisi: 你把變數echo出來看看? 12/16 22:45
plcder: 新的php沒有mysql_connect要用mysqli_connect 12/17 05:15
coechp: liisi大,用chrome瀏覽直接顯示HTTP ERROR 500 12/17 10:23
coechp: plcder大,改用mysqli_connect也是一樣http error500 12/17 10:24
plcder: 我指的不只改mysql_coonect下面語法都要改成適合mysqli語 12/18 01:37
plcder: 法 error500通常是server問題要看server對php設定問題 12/18 01:45
plcder: 可以打開phpinfo()看看裡面mysqli部分是否有開啟 12/18 01:56
cocobox: 雙引號裡面又包了雙引號在PHP裡面當然會死啊 12/18 11:16
liisi: 樓上get! 12/18 22:36