Printing result of mysql query from variable

后端 未结 4 1972
日久生厌
日久生厌 2021-02-07 15:58

So I wrote this earlier (in php), but everytime I try echo $test\", I just get back resource id 5. Does anyone know how to actually print out the mysql query from the variable?<

4条回答
  •  不知归路
    2021-02-07 16:40

    well you are returning an array of items from the database. so you need something like this.

       $dave= mysql_query("SELECT order_date, no_of_items, shipping_charge, 
        SUM(total_order_amount) as test FROM `orders` 
        WHERE DATE(`order_date`) = DATE(NOW()) GROUP BY DATE(`order_date`)") 
        or  die(mysql_error());
    
    
    while ($row = mysql_fetch_assoc($dave)) {
    echo $row['order_date'];
    echo $row['no_of_items'];
    echo $row['shipping_charge'];
    echo $row['test '];
    }
    

提交回复
热议问题