I'm trying to print multiple mysql rows, using mysql_fetch_array with while loop but it only prints the first result while my table contains many of them with the right conditions
$queryString="SELECT * FROM items WHERE order_id='".$order_id."' and confirm_order='0' ORDER BY id";
$myquery=mysql_query($queryString);
$handle = printer_open("POS");
printer_start_doc($handle, "My Document");
printer_start_page($handle);
$font = printer_create_font("Arial", 35, 20, 300, false, false, false, 0);
printer_select_font($handle, $font);
while ($fetch = mysql_fetch_array($myquery)) {
$product=$fetch[product_name];
$type=$fetch[type];
$q=$fetch[item_quantity];
$comment=$fetch[comment];
$tex="".$q." ".$type." ".$comment." ".$product."";
printer_draw_text($handle, $tex, 10, 10);
}
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
Note:- and I can't use mysqli or PDO as I'm just testing something on an old project
$fetch[product_name]should be$fetch['product_name'](this is a side remark, it doesn't answer the question.)error_reporting(E_ALL|E_NOTICE); in front of the script$product=$fetch[product_name]; $type=$fetch[type]; $q=$fetch[item_quantity]; $comment=$fetch[comment];Need to be:-$product=$fetch['product_name']; $type=$fetch['type']; $q=$fetch['item_quantity']; $comment=$fetch['comment'];(this is a side remark, it doesn't answer the question.)