我正在PHP/MySQLi
中使用两个mysql查询来将数据更新到mysql数据库。
在此代码中如何使用mysql_use_result()
和mysql_free_result()
。此php代码中的百老汇正在调用两个更新查询,但现在返回的是空值。有人可以帮助我吗?
这是我的php代码更新记录到数据库。
$sql_moneyboxs = "SELECT SUM(Amount) AS inflow
FROM payment_details WHERE DATE(created)='$todayDate' and paymentMode='cash' GROUP BY DATE(created)";
//$result2 = mysqli_query($link, $sql_get_sum_cash);
//$row2 = mysqli_fetch_array($result2);
//echo json_encode($row2);
//$sql_get_sum_cash->close();
//$account = $link->query($sql_moneybox)->fetch_assoc();
//$row3 = $account->fetch_assoc();
$sql_moneyboxs .= "SELECT SUM(Amount) AS inflow
FROM payment_details WHERE DATE(created)='$todayDate' and paymentMode='card' GROUP BY DATE(created)";
//$result3 = mysqli_query($link, $sql_get_sum_card);
//$row3 = mysqli_fetch_array($result3);
//echo json_encode($row3);
//mysqli_multi_query($link, $sql_moneybox);
//$profile = $link->query($sql_moneybox)->fetch_assoc();
//$row2 = $profile->fetch_assoc();
if (mysqli_multi_query($link, $sql_moneyboxs)) {
//do {
if ($result123 = $link->store_result()) {
while ($row123 = $result123->fetch_row()) {
//var_dump($row123); //for checking result
print($row123);
//echo $row['inflow'];
// Now use array to show your result
}
$result123->free();
} if ($link->more_results()) {
while ($link->next_result()){
$thisresult = $link->store_result();
print_r($thisresult).'<br />';
}
// while (mysqli_next_result($link)) ;
}
}
unset($sql_moneyboxs);