通過PHP串連MYSQL的兩種方法2_PHP教程

來源:互聯網
上載者:User
通過PHP串連MYSQL的兩種方法
著作權:bluemy/php中文使用者
轉載請與作者聯絡
例子可見我在本網站的"程式與代碼"裡的文章和下面的常式:
前台HTML
您 可 以 花 些 時 間 填 寫 下 表 , 也 可 以 用 電
子 郵 件 聯 系 ,likai333@21cn.com。
您的姓名:
您的電子郵件:
您欲做廣告的網站地址:
您欲做廣告的網站站名:
您的公司名稱:
您的聯絡電話:

後台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 "發生錯誤,請通知我";
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",
);

http://www.bkjia.com/PHPjc/531888.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/531888.htmlTechArticle通過PHP串連MYSQL的兩種方法 著作權:bluemy/php中文使用者 轉載請與作者聯絡 例子可見我在本網站的"程式與代碼"裡的文章和下面的常式: 前台...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.