Re: [請益] 請問PHP+MySQL可以這樣使用嗎?

看板PHP作者 (yornid)時間16年前 (2009/04/24 18:24), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《Allpower (傳說の肅老)》之銘言: : 我的想法是當按下按鈕後,呼叫test函數, : 此時test函數再跟資料庫連線,取得一筆時 : 間型態的值來跟目前時間作比較,請問這種 : 想法可行嗎?因為我光第一步就失敗了… : 還請各位前輩幫忙,謝謝。 : <?php : function test(){ : $link = @mysql_connect("localhost", "root", "password") or die("FAIL!" : . mysql_error()); : echo "SUCCESS!"; : mysql_close($link);} : ?> : <html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml"> : <head> : <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> : <title>無標題文件</title> : </head> : <body> : <input name="Submit" type="button" onclick="test()" value="按鈕" /> : </body> : </html> 我想你應該是搞錯了,你應該要用的是ajax做一個request 到php檔案. 你可能要先搞清楚client scripting 跟server scripting的不同。 -- 順風,逆風  迎風而起 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.140.36.150
文章代碼(AID): #19yPDtYm (PHP)
文章代碼(AID): #19yPDtYm (PHP)