在我进行第二次盘问之后,我又如何使用第一种盘问值<代码>。 下面是我试图做的事情的样本。
我希望我对此作了解释。
这里是法典。
$mysqli = mysqli_connect("localhost", "root", "", "sitename");
$dbc = mysqli_query($mysqli,"SELECT users.*
FROM users
WHERE user_id = 4");
if (!$dbc) {
// There was an error...do something about it here...
print mysqli_error($mysqli);
}
while($row = mysqli_fetch_assoc($dbc)) {
echo <div>User: . $row[ id ] . </div> ;
echo <div>Link To User . $row[ id ] . </div> ;
$mysqli = mysqli_connect("localhost", "root", "", "sitename");
$dbc2 = mysqli_query($mysqli,"SELECT COUNT(cid) as num
FROM comments
WHERE comments_id = $row[id]");
if (!$dbc2) {
// There was an error...do something about it here...
print mysqli_error($mysqli);
} else {
while($row = mysqli_fetch_array($dbc2)){
$num = $row[ num ];
}
}
echo <div>User . $row[ id ] . Comments# . $num . </div> ;
}