php根據參數從讀取資料庫記錄這是一款php 讀取資料庫記錄,只是我們更深層的作了處理,就是把使用者url地址欄傳過來的參數再從資料庫中查詢了,如,使用者登陸,註冊,增加記錄,新聞顯示都會用到哦。
php教程根據參數從讀取資料庫教程記錄
這是一款php 讀取資料庫記錄,只是我們更深層的作了處理,就是把使用者url地址欄傳過來的參數再從資料庫中查詢了,如,使用者登陸,註冊,增加記錄,新聞顯示都會用到哦。
*/
$host = 'localhost';
$user_name = 'root';
$password = 'admin';
$id = $_get['id'];
$conn = mysql教程_connect($host,$user_name,$password);
if(!$conn)
{
die('資料庫連接失敗:'.mysql_error());
}
mysql_select_db('test');
$sql = 'select id,name,city from users where id='.$id;
$result = mysql_query($sql) or die("
error: ".mysql_error()."
產生問題的sql:".$sql);
if($num = mysql_num_rows($result))
{
echo '
';
while($row = mysql_fetch_array($result,mysql_assoc))
{
print_r($row);
}
}
else
{
echo '你要查詢的資料己經學存在了';
}mysql_close($conn);
?>
查詢id=2的記錄
http://www.bkjia.com/PHPjc/630823.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630823.htmlTechArticlephp根據參數從讀取資料庫記錄這是一款php 讀取資料庫記錄,只是我們更深層的作了處理,就是把使用者url地址欄傳過來的參數再從資料庫中查...