in reply to DBI forgets last record
you try to retrieve a row. There might not be one, in which case you print "no items". But if there is, you don't assign the return value to a variable, so it just gets thrown away -- yet the results pointer still moves forward. That row won't show up in the list you generate in your while loop.
A possible fix could work something like this (untested):
my @fields = $sth->fetchrow_array(); if (!@fields) { print "NO ITEMS IN CART"; } else { while (@fields) { my ($id,$prod_id,$qty) = @fields; print "====== $id ======<br>"; @fields = $sth->fetchrow_array(); } }
$perlmonks{seattlejohn} = 'John Clyman';
|
|---|