Re: Looping almost the same repetitive lines

Nikos wrote:

$st = $db->prepare( "SELECT * FROM counter" );
you need to check the return value of this.

What happens when you execute this statement directly within the db
console? (mysql in this case) Do you get any results?

and checj the return value of this.

$row = $st->fetchrow_hashref;

@tableRows = ();

while( $item = $st->fetchrow_hashref()) {
    push @tableRows, $item;

What happens when you use Data::Dumper to display @tablerows? Is it empty? If so, you have an issue with your query.

print table( {class=>'info'},
    map {
            td( submit( -name=>'game', -value=>$_->{name} )),
            td( $_->{text} ),
            td( $_->{name} )
        } @tableRows

Whne i perl -c it says syntax OK from command line
Fine: it compiles. That doesn't tell us a lot. What happens when you *run* it?

when i view it from the broswer the only thing it displays is some other text above that code and nothing more. i t not evne designs the table.
You need to learn to partition your problem. What the browser displays is academic at this point; first of all you need to ascertain what the script is doing at what it outputs. You don't seem to know how to debug your programs.

You *need* to use strict. You *need* to use warnings. You *need* to use my. If you don't understand why, you need to read some more.


Relevant Pages

  • Re: [9fans] PUSH sources for Plan 9
    ... running push -r ... ... file descriptors are there. ... list is empty for both. ... echo hello |< cat>| cat ...
  • Re: Spurious Data returned from empty db column...
    ... when the record field contains an empty string, ... Apparently MySQL returns something ... different for an empty CHAR -vs- an empty VARCHAR. ... > Retrieving a 0-length string from a MySQL table column ...
  • Re: Vector Sort Predicate Not Called
    ... "reserve" only reserve memory space to push al least PopSize elements in the ... but the vector is empty. ...
  • Re: Regular expression help
    ... I am trying to import entries in a csv file into a relational database, ... push @rec, ""; ... } elsif { ... Is this a commonly used method where you push empty values into an array ...
  • Re: [9fans] PUSH sources for Plan 9
    ... any instance of that string, ... echo hello |< cat>| cat ... rc (push): empty argument list ...