//其實我也就插入失敗50次而已,沒有一百次
//首先語句是mysqli_query,而不是mysql_query
//其次系統(tǒng)老是提示需要傳入兩個參數(shù),是因為沒把$con寫進去
//看看http://www.runoob.com/php/func-mysqli-query.html的標準寫法就知道了,我把兩個參數(shù)寫反了
if(mysqli_query($con,'insert into test1(username)values("abc")')){
echo "成功插入";
}else{echo "插入失敗";
}
//首先語句是mysqli_query,而不是mysql_query
//其次系統(tǒng)老是提示需要傳入兩個參數(shù),是因為沒把$con寫進去
//看看http://www.runoob.com/php/func-mysqli-query.html的標準寫法就知道了,我把兩個參數(shù)寫反了
if(mysqli_query($con,'insert into test1(username)values("abc")')){
echo "成功插入";
}else{echo "插入失敗";
}
2016-03-29
//這樣寫就沒問題了
if(mysqli_select_db($con,'first')){
echo "選擇數(shù)據(jù)庫成功";
}else{
echo "選擇數(shù)據(jù)庫失敗";
}
if(mysqli_select_db($con,'first')){
echo "選擇數(shù)據(jù)庫成功";
}else{
echo "選擇數(shù)據(jù)庫失敗";
}
2016-03-29
我連接后 提示 Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in G:\wamp\www\index.php on line 2
2016-03-28
<?php //連接數(shù)據(jù)庫
mysql_connect('127.0.0.1', 'code1', ''); mysql_select_db('code1'); mysql_query("set names 'utf8'"); //在這里進行數(shù)據(jù)查詢
$res=mysql_query('select * from user');
$row=mysql_fetch_array($res);
var_dump($row);
mysql_connect('127.0.0.1', 'code1', ''); mysql_select_db('code1'); mysql_query("set names 'utf8'"); //在這里進行數(shù)據(jù)查詢
$res=mysql_query('select * from user');
$row=mysql_fetch_array($res);
var_dump($row);
2016-03-25
經(jīng)過測試,D:$q2=mysql_query(‘select count(*)from a’)
使用echo輸出,顯示
Catchable fatal error: Object of class mysqli_result could not be converted to string錯誤
使用print_r輸出,顯示
mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 1 [type] => 0 )
明顯了,這就是一組Object 對象
使用echo輸出,顯示
Catchable fatal error: Object of class mysqli_result could not be converted to string錯誤
使用print_r輸出,顯示
mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 1 [type] => 0 )
明顯了,這就是一組Object 對象