无法回显已执行的查询,如下所示:
<?php
$ID=$_GET['id'];
$sql="SELECT * FROM request WHERE repID='$ID' AND status='Stat
Requested'";
$sqlxc=mysql_query($check);
echo $sqlxc;
?>
我想在请求状态时显示repid的状态。
答案 0 :(得分:-2)
<?php
$ID=$_GET['id'];
$sql="SELECT * FROM request WHERE repID='$ID' AND status='Stat Requested'";
$result = $conn->query($sql) or die($conn->error);
while($row = $result->fetch_assoc()) {
$Result1= 'Hello '.$row['row1'];
$Result2='Hello '.$row['row2'];
Echo $Result1;
Echo $Result2;
}
?>
//you can also prepare the statement using bind params:
$ID=$_GET['id'];
$stmt =$conn->prepare("SELECT * FROM request WHERE repID=? AND status='Stat Requested'");
$stmt->bind_param("s", $ID);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$Result1= 'Hello '.$row['row1'];
$Result2='Hello '.$row['row2'];
Echo $Result1;
Echo $Result2;
}