語句執(zhí)行,插入失敗
<?php header("Content-type:text/html;?charset=utf-8");? if($con=mysql_connect('localhost','root','')){??? echo?'連接成功'; }else{ echo?'連接失敗'; } if(mysql_select_db('user')){???//選擇數(shù)據(jù)庫 echo?'選擇數(shù)據(jù)庫成功'; }else{ echo?'選擇數(shù)據(jù)庫失敗'; } if(mysql_query('insert?into?test(mytitle,mymgs)?values("abc","bca")')){ echo?'插入成功'; }else{ echo?'插入失敗'; } 我的數(shù)據(jù)庫名為user,表名也是user?表里有?id??mytitle????mymsg?三個(gè)字段,??上面的語句執(zhí)行,插入失敗;
2016-08-31
if
(mysql_query(
'insert?into?
user
/*表名*/
(mytitle,mymgs)?values("abc","bca")'
)){
echo
?'插入成功'
;
}
else
{
echo
?'插入失敗'
;
}
2016-09-02
insert into 后邊的是表名!你的表名是user ,可是你寫的是test
2016-08-31
表名是user?引:insert?into?test(mytitle,mymgs)。 ? 你這是往表名為test的表里面插入數(shù)據(jù)呢~