[請益]A網頁 寫入資料 到資料庫核對....

看板PHP作者 (smallred)時間16年前 (2009/05/03 17:26), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串1/2 (看更多)
我再寫一個網頁,昨天都還好好的.....今天卻不行了,都不知道什麼原因 內容很簡單,請幫我看看,是哪個地方錯了... <html> <head> <title>userform</title> </head> <body> <form action="userform.php" method="post"> 帳號:<input type="text" name="id" size="12"><br> 密碼:<input type="password" name="password" size="12"><p> EMAIL:<input type="text" name="email" size="48"><p> 手機:<input type="password" name="sellphone" size="12"><p> <input type="submit" name="submit" value="傳送"> <input type="reset" name="reset" value="重填"> </form> </body> </html> 這是第二支程式 <html> <body> <form> frtre //這是看有沒有進入,會顯示在螢幕,但都沒有 <?php include_once("link.php"); echo "dewrwerwr"; //這也是測試有沒有進這畫面,但都沒有.... $id=$_POST['id']; $password=$_POST['password']; $email=$_POST['email']; $sellphone=$_POST['sellphone']; if($id != ""&& $email != "" ) { $query="SELECT*FROM usertable WHERE id= '$id';"; $result=mysql_query($query,$link); if(mysql_num_fields($result)==-1){ $query="INSERT INTO usertable (id,password,lot,lat,friend,line,status,address,email,sellphone)VALUES ('$id','$password','','','','','','','$email','$sellphone');"; $result=mysql_query($query,$link); echo "新增成功";} }else echo "sorry you input user "; <a href="userform.html"> input </a> <br> ?> </form> </body> </html>put </a> <br> ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.74.103.38

05/03 23:40, , 1F
SELECT*FROM 你這邊連在一起了
05/03 23:40, 1F

05/03 23:41, , 2F
變數的地方最好改用 WHERE id= '".$id."'
05/03 23:41, 2F

05/04 09:09, , 3F
無言了...最後兩個"?>"是怎麼回事?...位置有問題!
05/04 09:09, 3F

05/04 09:11, , 4F
我比較好奇,你的編輯器不會將PHP Code和HTML分色嗎?
05/04 09:11, 4F
文章代碼(AID): #19_MCyT0 (PHP)
文章代碼(AID): #19_MCyT0 (PHP)