我已经编写了这段代码,但是我应该准备好语句,我已经尝试过但没有显示任何内容
这是准备好的语句之前的代码
$aproved='1';
$conn = new mysqli(...);
$sql = "SELECT * FROM tda WHERE aproved = '$aproved'";
$result = mysqli_query($conn, $sql);
$queryResults = mysqli_num_rows($result);
if($queryResults > 0)
{
while ($row = mysqli_fetch_assoc($result))
{
$connection = new mysqli(..);
echo " <li>
<a href='../reportaje/tda.php?title=".$row['d_title']."&date=".$row['d_dat']."&hmm=".$row['d_id']."'>
".$row['d_title']."
</a>
</li>";
这是带有预准备语句的代码,但它不起作用
$aproved='1';
$mysqli = new mysqli(...);
$stmt = $mysqli->prepare("SELECT * FROM myTable WHERE name = ?");
$stmt->bind_param("tda", $aproved);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows === 0)
exit('No rows');
while($row = $result->fetch_assoc())
{
echo " <li>
<a href='../reportaje/tda.php?title=".$row['d_title']."&date=".$row['d_dat']."&hmm=".$row['d_id']."'>
".$row['d_title']."
</a>
</li>";
}
$stmt->close();
并且我没有任何错误
答案 0 :(得分:0)
您有一些翻译无法确定其来源,但应该更像是...
return trackPath.copy(strokingWithWidth: 6, lineCap: CGLineCap.round, lineJoin: CGLineJoin.round, miterLimit: 10) as! CGMutablePath
bind_param()
将绑定的数据类型作为第一个参数。
还将表名从$stmt = $mysqli->prepare("SELECT * FROM tda WHERE aproved = ?");
$stmt->bind_param("s", $aproved);
$stmt->execute();
移回SQL语句,并调整搜索的字段名。