欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

php插入數(shù)據(jù)庫不能用 php向數(shù)據(jù)庫添加數(shù)據(jù)失敗

Php無法向數(shù)據(jù)庫插入數(shù)據(jù)

INSERT INTO msg(title,contents,dates) VALUES ($title,$cons,now())

創(chuàng)新互聯(lián)公司成都企業(yè)網(wǎng)站建設(shè)服務(wù),提供成都做網(wǎng)站、成都網(wǎng)站制作網(wǎng)站開發(fā),網(wǎng)站定制,建網(wǎng)站,網(wǎng)站搭建,網(wǎng)站設(shè)計,響應(yīng)式網(wǎng)站設(shè)計,網(wǎng)頁設(shè)計師打造企業(yè)風(fēng)格網(wǎng)站,提供周到的售前咨詢和貼心的售后服務(wù)。歡迎咨詢做網(wǎng)站需要多少錢:18982081108

將字段名兩邊的單引號去掉就沒問題了,親測成功!希望能幫到你。

php 插入數(shù)據(jù)庫無效

親,你數(shù)據(jù)庫id設(shè)置成自動生成,不用插入數(shù)據(jù)可了吧,我給你一段我寫的注冊,你看看,原理一樣,你改下sql語句插入就ok

?php

if($_POST["submit"]){

if(empty($_POST['member_user']))

echo "scriptalert('帳號不能為空');location='?tj=register';/script";

else if(empty($_POST['member_password']))

echo "scriptalert('密碼不能為空');location='?tj=register';/script";

else if($_POST['member_password']!=$_POST['pass'])

echo "scriptalert('兩次密碼不一樣');location='?tj=register';/script";

else if(!empty($_POST['member_qq'])!is_numeric($_POST['member_qq']))

echo "scriptalert('qq號必須全為數(shù)字');location='?tj=register';/script";

else if(!empty($_POST['member_phone'])!is_numeric($_POST['member_phone']))

echo "scriptalert('手機號碼必須全為數(shù)字');location='?tj=register';/script";

else if(!empty($_POST['member_email'])!ereg("([0-9a-zA-Z]+)([@])([0-9a-zA-Z]+)(.)([0-9a-zA-Z]+)",$_POST['member_email']))

echo "scriptalert('郵箱輸入不合法');location='?tj=register';/script";

else{

$_SESSION['member']=$_POST['member_user'];

$sql="insert into member values('','".$_POST['member_user']."','".$_POST['member_password']."','".$_POST['member_name']."','".$_POST['member_sex']."','".$_POST['member_qq']."','".$_POST['member_phone']."','".$_POST['member_email']."')";

$result=mysql_query($sql)or die(mysql_error());

if($result)

echo "scriptalert('恭喜你注冊成功,馬上進(jìn)入主頁面');location='member.php';/script";

else

{

echo "scriptalert('注冊失敗');location='index.php';/script";

mysql_close();

}

}

}

?

form id="theForm" name="theForm" method="post" action="" onSubmit="return chk(this)" runat="server" style="margin-bottom:0px;"

table width="350" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#B3B3B3"

tr

td colspan="2" align="center" bgcolor="#EBEBEB"會員注冊 以下打“*”為必填項/td

/tr

tr

td width="60" align="right" bgcolor="#FFFFFF"賬 號:/td

td width="317" bgcolor="#FFFFFF"input name="member_user" type="text" id="member_user" size="20" maxlength="20" /

font color="#FF0000" */font(由數(shù)字或字母組成)/td

/tr

tr

td align="right" bgcolor="#FFFFFF"密 碼:/td

td bgcolor="#FFFFFF"input name="member_password" type="password" id="member_password" size="20" maxlength="20" /

font color="#FF0000" */font(由數(shù)字或字母組成)/td

/tr

tr

td align="right" bgcolor="#FFFFFF"確認(rèn)密碼:/td

td bgcolor="#FFFFFF"input name="pass" type="password" id="pass" size="20" /

font color="#FF0000" */font(再次輸入密碼)/td

/tr

tr

td align="right" bgcolor="#FFFFFF"真實姓名:/td

td bgcolor="#FFFFFF"input name="member_name" type="text" id="member_name" size="20" /

labelfont color="#FF0000"*/font/label/td

/tr

tr

td align="right" bgcolor="#FFFFFF"性 別:/td

td align="left" bgcolor="#FFFFFF"

input name="member_sex" type="radio" id="0" value="男" checked="checked" /

input type="radio" name="member_sex" value="女" id="1" /

女 /label/td

/tr

tr

td align="right" bgcolor="#FFFFFF"Q Q:/td

td bgcolor="#FFFFFF"input name="member_qq" type="text" id="member_qq" size="20"http://td

/tr

tr

td align="right" bgcolor="#FFFFFF"聯(lián)系方式:/td

td bgcolor="#FFFFFF"input name="member_phone" type="text" id="member_phone" size="20"http://td

/tr

tr

td align="right" bgcolor="#FFFFFF"電子郵箱:/td

td bgcolor="#FFFFFF"input name="member_email" type="text" id="member_email" size="20"http://td

/tr

tr

td colspan="2" align="center" bgcolor="#FFFFFF"input type="reset" name="button" id="button" value="重置表單" /

input type="submit" name="submit" id="submit" value="確定注冊" //td

/tr

/table

/form

php表單數(shù)據(jù)無法插入數(shù)據(jù)庫,新人請指教。

$sql="INSERT

INTO

news(`id`,`title`,`dates`,`contents`)

VALUES

('','{$title}',now(),'{$con}')";

你的SQL語句有點問題。還有SQL不分大小寫,但這樣寫更清楚一些。

先確認(rèn)數(shù)據(jù)庫連接是正常的,然后echo

$sql

看看,數(shù)據(jù)是否正常,然后再寫入庫。

出問題了調(diào)試要步步試下來,就知道問題出在哪里了。

網(wǎng)站名稱:php插入數(shù)據(jù)庫不能用 php向數(shù)據(jù)庫添加數(shù)據(jù)失敗
文章位置:http://chinadenli.net/article18/ddocdgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)品牌網(wǎng)站設(shè)計移動網(wǎng)站建設(shè)網(wǎng)站策劃定制開發(fā)軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)