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

看板PHP作者 (傳說の肅老)時間16年前 (2009/04/20 15:59), 編輯推噓1(103)
留言4則, 3人參與, 最新討論串1/2 (看更多)
我的想法是當按下按鈕後,呼叫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> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.46.144.125

04/20 16:01, , 1F
js 跟 php 搞混了。btw 你要的功能可用 ajax 達成。
04/20 16:01, 1F

04/20 16:06, , 2F
樓上的大大可以多透露點嗎?小弟php+MySQL是初學,
04/20 16:06, 2F

04/20 16:07, , 3F
更別說是用ajax去連資料庫了…Orz
04/20 16:07, 3F

04/20 16:19, , 4F
初學者 我想還是先學好 form GET POST 吧
04/20 16:19, 4F
文章代碼(AID): #19x2jdUe (PHP)
文章代碼(AID): #19x2jdUe (PHP)