Re: [請益] 小問題

看板PHP作者 (愛喝水的純水)時間18年前 (2007/08/01 10:50), 編輯推噓2(202)
留言4則, 2人參與, 最新討論串7/9 (看更多)
※ 引述《Chouje (~~哇是卡倉~~)》之銘言: : 今天在做與資料庫連結的小綀習時~程式碼如下: : ------------------------------------------------------------------------------ : <html> : <body> : <?php : if (isset($old_name)){ : $link_ID = mysql_connect("localhost:3306","root"); : mysql_select_db("bc_book"); : $str = "select * from customers where name='$old_name';"; : $result = mysql_query($str,$link_ID); : mysql_close($link_ID); : $record = mysql_fetch_row($result); 可以試試看把上面這兩行對調看看,我看到的範例通常都是mysql_close()放在程式後面 試試看吧^^ 我在想有可能是mysql_close()之後,就無法在用mysql的函式了!! 有可能$result所接收到的值還是mysql的一部分 : } : -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.216.5.210

08/01 10:53, , 1F
我試了~還是一樣啊~~>"<~~到底該怎麼辦@@~是啥麼問題~一一a
08/01 10:53, 1F
※ 編輯: spp72 來自: 61.216.5.210 (08/01 10:56)

08/01 12:31, , 2F
$str=sprintf("select * from a where b='%s'", $old_name)
08/01 12:31, 2F

08/01 12:32, , 3F
試試這樣呢!可是你的錯誤訊息是你的link參數不合法阿@@
08/01 12:32, 3F

08/01 12:34, , 4F
所以我覺得在SQL語法上面做調整也不知道有沒有效果= . =
08/01 12:34, 4F
文章代碼(AID): #16h_KIBf (PHP)
討論串 (同標題文章)
本文引述了以下文章的的內容:
2
2
完整討論串 (本文為第 7 之 9 篇):
1
11
2
4
4
10
3
4
0
2
2
6
2
2
文章代碼(AID): #16h_KIBf (PHP)