我是 PHP 新手 .. 我被困在如何将我的 sql 语句转移到准备好的语句上 .. 我得到的错误消息是你“无法连接” ..
我的代码如下
$connection = mysql_connect($host,$username,$password) or die ("can't connect");
$select_database = mysql_select_db($db_name);
$id = mysql_real_escape_string ($_GET ['id']);
$query = 'SELECT * from &tbl_name where id=?';
$stmt = $connection->prepare($query);
$stmt->bind_param("d", $id);
$stmt->execute();
$rows=mysql_fetch_array($stmt);
$stmt->close();