脚本宝典收集整理的这篇文章主要介绍了php – 将$item = mysql_fetch_assoc($stmt)更改为预准备语句样式,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$rose_id = $_GET['rose_id']; //PRepare the statement $stmt = $conn2->prepare("SELECT * From rosename LEFT JOIN roseVARiety ON (rosename.variety_name = rosevariety.variety_name) WHERE rose_id = ?"); //bind the parameters $stmt->bind_param("i",$rose_id); //$sql = MysqL_query($query,$conn); $stmt->execute(); //was there a good response? if ($stmt) { $rose = MysqL_fetch_assoc($stmt); //echo out rose information echo "<h1>".$rose['latin_name']."</h1>"; echo "<h2>".$rose['common_name']."</h2>";
$rose = $stmt->fetch(PDO::FETCH_ASSOC);
http://www.php.net/manual/en/pdostatement.fetch.php
如果使用MysqLi:
$result = $stmt->get_result(); $rose = $result->fetch_assoc();
http://www.php.net/manual/en/mysqli-stmt.get-result.php
http://php.net/manual/en/mysqli-result.fetch-assoc.php
以上是脚本宝典为你收集整理的php – 将$item = mysql_fetch_assoc($stmt)更改为预准备语句样式全部内容,希望文章能够帮你解决php – 将$item = mysql_fetch_assoc($stmt)更改为预准备语句样式所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。