第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用PHP寫一個簡單的注冊頁面要鏈接MySQL數(shù)據(jù)庫。用pdo預(yù)處理。實(shí)在寫不出來了。求幫助

用PHP寫一個簡單的注冊頁面要鏈接MySQL數(shù)據(jù)庫。用pdo預(yù)處理。實(shí)在寫不出來了。求幫助

小楊的樣 2017-10-09 23:00:40
這是代碼。。。。<!doctype html><html><head><meta charset="utf-8"><title>注冊</title></head><body><form action="log_in.php" method="post"> <label for="">名&nbsp;&nbsp;字:</label> <input type="text" name="user_name" maxlength="20"/><br/><br/> <label for="">學(xué)&nbsp;&nbsp;號:</label> <input type="text" name="user_id" maxlength="9" /><br/><br/> <label for="">電話號碼:</label> <input type="text" name="user_phone" maxlength="11"/><br/><br/> <label for="">住&nbsp;&nbsp;址:</label> <input type="text" name="user_address" maxlength="50"/><br/><br/> <input type="submit" value="注冊"><?php header('Content-Type:text/html;charset=utf-8'); //數(shù)據(jù)庫的服務(wù)器類型是mysql $dbms='mysql'; //數(shù)據(jù)庫服務(wù)器主機(jī)名、端口號、選擇的數(shù)據(jù)庫 $host='localhost'; $port='3306'; $dbname='book'; //用戶名和密碼 $user='root'; $pwd=null; $dsn="$dbms:host=$host;port=$port;dbname=$dbname;charset=utf8"; try{ //實(shí)例化PDO創(chuàng)建數(shù)據(jù)庫服務(wù)器連接 $pdo=new PDO($dsn,$user,$pwd); if($_SERVER['REQUEST_METHOD']=='post'){ //執(zhí)行SQL語句 $sql="insert into user valuses(null,:name,:id,:phone,:address)"; //生成預(yù)處理語句 $stmt=$pdo->prepare($sql); $name=$_POST['user_name']; $id=$_POST['user_id']; $phone=$_POST['usere_phone']; $address=$_POST['user_address']; $stmt->bindParam(":sid",$sid); $stmt->bindParam(":id",$id); $stmt->bindParam(":phone",$phone); $stmt->bindParam(":address",$address); } }catch(PDOExcption $e){ echo $e->getMessage().'<br>'; }?><br/><br/></body></html>
查看完整描述

1 回答

?
林逸舟丶

TA貢獻(xiàn)124條經(jīng)驗 獲得超28個贊

其實(shí)不用特別在意對數(shù)據(jù)庫的操作。

先去學(xué)學(xué)MVC思想,

然后學(xué)習(xí)一下ThinkPHP框架(因為簡單,且有中文使用文檔)。

再回過頭來,你就知道為什么我會讓你這么做了。

記得采納答案。

查看完整回答
反對 回復(fù) 2017-10-10
  • 1 回答
  • 1 關(guān)注
  • 2281 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號