$conn=new mysqli('host','user','pw','db');
$id = 7;
$stmt = $conn->stmt_init();
$stmt->prepare("select id,topic from news where id=?");
$stmt->bind_param("i",$id);
$stmt->execute();
$stmt->bind_result($col1,$col2);
while ($stmt->fetch())
{
printf("%s %s\n", $col1, $col2);
}
$stmt->close();
$conn->close();
$id = 7;
$stmt = $conn->stmt_init();
$stmt->prepare("select id,topic from news where id=?");
$stmt->bind_param("i",$id);
$stmt->execute();
$stmt->bind_result($col1,$col2);
while ($stmt->fetch())
{
printf("%s %s\n", $col1, $col2);
}
$stmt->close();
$conn->close();
沒有留言:
張貼留言