国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

通過PHP連接MYSQL的兩種方法(2)

2024-07-24 12:56:06
字體:
來源:轉載
供稿:網友
例子可見我在本網站的"程序與代碼"里的文章和下面的例程:

前臺html

< form enctype="multipart/form-data" action="hb_ggzd.php" method="post" >
< tr >
< td width="251" >< small >您 可 以 花 些 時 間 填 寫 下 表 , 也 可 以 用 電
子 郵 件 聯 系 ,< a href="mailto:[email protected]" >[email protected]< /a >。< /small >< /td >
< /tr >
< tr >
< td valign="top" width="251" height="31" >< small >您的姓名:< /small >< /td >
< td width="462" height="31" >< small >< input name="name" size="20" > < /small >< /td >
< /tr >
< tr >
< td valign="top" width="251" height="30" >< small >您的電子郵件:< /small >< /td >
< td width="462" height="30" >< small >< input name="usermail" size="37" >< /small >< /td >
< /tr >
< tr >
< td valign="top" width="251" height="25" >< small >您欲做廣告的網站地址:< /small >< /td >
< td width="462" height="25" >< small >< small >< input name="userurl" size="37" value="http://" >< /small >< /small >< /td >
< /tr >
< tr >
< td valign="top" width="251" height="25" >< small >您欲做廣告的網站站名:< /small >< /td >
< td width="462" height="25" >< small >< input name="sitename" size="20" >< /small >< /td >
< /tr >
< tr >
< td valign="top" width="251" height="30" >< small >您的公司名稱:< /small >< /td >
< td width="462" height="30" >< small >< input name="company" size="37" >< /small >< /td >
< /tr >
< tr >
< td valign="top" width="251" height="25" >< small >您的聯系電話:< /small >< /td >
< td width="462" height="25" >< small >< input name="phone" size="20" >< /small >< /td >
< /tr >
< tr >
后臺php

< ?php
$dbh = mysql_connect('localhost:3306','root','');
mysql_select_db('hbweb');
$query ="insert into usemsg ( name,usermail,userurl,sitename, company,phone) values ('$name','$usermail','$userurl', '$sitename', '$company','$phone','$c1','$c2','$c3','$c4','$c5')";
$res = mysql_query($query, $dbh);
$err = mysql_error();
if($err){
echo "發生錯誤,請通知< a href=mailto:[email protected] >我< /a >";
echo "$err";
}
else
{ echo "成功入庫"; }

? >

表結構:

create table usemsg (
name varchar(255) not null default "notname",
usermail varchar(255) not null default "notusermail",
userurl varchar(255) not null default "notuserurl",
sitename varchar(255) not null default "notsitename",
company varchar(255) not null default "notcompany",
phone varchar(255) not null default "notphone",
);

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 郎溪县| 云林县| 双牌县| 庄浪县| 克山县| 偃师市| 乌苏市| 宁晋县| 建平县| 正镶白旗| 南和县| 佳木斯市| 新晃| 惠来县| 响水县| 板桥市| 濮阳市| 汉沽区| 孝昌县| 康马县| 琼海市| 达拉特旗| 兴隆县| 康马县| 瑞丽市| 奉贤区| 光泽县| 伊春市| 嘉禾县| 黑水县| 资溪县| 凌源市| 鲁甸县| 杭州市| 华阴市| 和林格尔县| 吉隆县| 常宁市| 会同县| 长岭县| 永春县|