【问题标题】:PHP Mysqli. Need to fetch data from tablePHP Mysqli。需要从表中获取数据
【发布时间】:2016-08-02 12:03:17
【问题描述】:

这是我的代码。我执行然后什么也没发生。请检查我的代码

$id = trim(htmlentities($_REQUEST['id'],ENT_QUOTES)); //call the action from previous page

//fetch data
$stmt = $dbi->prepare("SELECT a.telco, a.no_siri, a.no_topup, a.amount, a.requestingAgentID, a.requestDateTime, a.isUsed, b.name FROM card_telco a LEFT JOIN agents b ON a.requestingAgentID = b.id WHERE id = ?"); //query
$stmt->bind_param('s', $id); //binding
mysqli_stmt_execute($stmt); //execute
mysqli_stmt_store_result($stmt); //store the result
$count = mysqli_stmt_num_rows($stmt); //execute rows
$stmt->bind_result($newTelco, $noSiri, $noTopup, $newAmount, $newRequestAgentID, $newRequestDateTime, $isUsing, $newName, $agendId); //binding new result
$stmt->execute() or die(mysqli_error()); //execute the statement
$stmt->store_result() //store new result
$stmt->fetch(); //fetch the data
$stmt->close(); //close the statement

ChromePhp::log('here'); //console
ChromePhp::log($newTelco, $noSiri); //console

【问题讨论】:

  • 您遇到了什么错误?
  • @Anant 我的本地主机说页面不工作。
  • $stmt->bind_param('i', $id); //binding
  • @Anant 也一样 :(
  • 当我评论我的代码时。页面工作。

标签: php mysql mysqli chromelogger


【解决方案1】:

好的,我明白了!我的查询错误。

从 card_telco 中选择 a.id、a.telco、a.no_siri、a.no_topup、a.amount、a.requestingAgentID、a.requestDateTime、a.isUsed、b.name a LEFT JOIN 代理 b ON a.requestingAgentID = b.id WHERE a.id = ?

这是我的新查询。谢谢你帮助我

【讨论】:

    猜你喜欢
    • 2013-10-14
    • 2018-11-23
    • 2014-09-19
    • 1970-01-01
    • 1970-01-01
    • 2019-10-24
    • 2020-10-06
    • 1970-01-01
    • 2021-10-01
    相关资源
    最近更新 更多