后台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:likai333@21cn.com >我< /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", ); |
正在阅读:通过PHP连接MYSQL的两种方法(2)通过PHP连接MYSQL的两种方法(2)
2004-02-14 09:33
出处:PConline
责任编辑:zwg
键盘也能翻页,试试“← →”键