看板 PHP 關於我們 聯絡資訊
以下有一小段程式碼 想請問大大這樣用是否有錯誤 <?php $key=$_GET['key']; for($i=0;$i<7;$i++) { $id="select * from $type[$i] where NUMBER='$key'"; $result=mysql_query($id); $rows=mysql_num_rows($result); if($rows=1) { break; } } ?> 有請指教 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.210.81
mosluce :字串裡似乎不能用=> $type[$i] 09/24 08:55
lindoyle :這樣的資料庫用法,效能上應該有瓶頸 09/24 09:03
miad :if($rows=1) 用if($rows==1) 09/24 09:56
windofsea :那一樓說的要怎解 09/24 10:21
mosluce :"str_header".$type[$i]."str_footer"; 09/24 11:31
bibo9901 :"xxxx{$type[$i]}xxxx" 也可以 09/24 11:35
headking :感恩QQ 09/24 15:51
headking :我正好也有同樣困擾 09/24 15:51
bobju :也可利用sprintf,結構清楚. 09/24 21:34