Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: dynamic website, putting data into right tablefield's

by agianni (Hermit)
on Apr 17, 2007 at 17:13 UTC ( [id://610584]=note: print w/replies, xml ) Need Help??


in reply to Re: dynamic website, putting data into right tablefield's
in thread dynamic website, putting data into right tablefield's

Your first step strikes me as unnecessary. I'm guessing that you're trying to avoid accidentally putting data in the wrong cells because some cells data is not there. But as long as you go through all of the products and sups when you output the data, you shouldn't have a problem.

The benefit of your solution is that you could do something like:

for my $prod ( keys %rowhash ){ for my $sup ( keys %{$rowhash{$prod}} ){ print "$rowhash{$prod}{$sup}{DATA_F}, $rowhash->{$prod}{$sup}{DA +TA_S}\t"; } print "\n"; }

...because all of the options are encapsulated in each row, but that is sort of treating a hash like an array. If you skip your first step of populating the hash with empty values, you should still be able to do something like:

for my $prod ( @total_pid ){ for my $sup ( @total_sup ){ print "$rowhash{$prod}{$sup}{DATA_F}, $rowhash{prod}{$sup}{DATA_ +S}\t"; } print "\n"; }

Because you always know what your complete list of products and sups are.

perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'

Replies are listed 'Best First'.
Re^3: dynamic website, putting data into right tablefield's
by ultibuzz (Monk) on Apr 17, 2007 at 18:16 UTC

    cheers,
    well the script know of all active products at the now state and all historical active products, that may be inactive or still active.
    anyway i need to treat both of them, if someone wants to edit old data it shoud add the now active products to the historical ones.
    with prebuilding the array with total_pid i get sure all,historical and now, products are in there ;), gives me a better feeling ^^.
    when i only run ym_cty_product i may miss a product.
    when i update/ insert into the database without the first run (empty values i miss some data in db, can be my update/insert sub but with first run everything looks fine in db
    please correct me if i don't get somthing wrong because im quit new into these HoH and so on ^^

    kd ultibuzz

    PS: the data can not be entered in the wrong cell because each cell contains a sup and product, so every value is unique accesible.
    i'will post my table creation tomorrow from office, i think this makes it clearer then my PS ^^

    Update: here is my table code looks a bit messy but it works ^^

    foreach my $row (@total_sup) { my $sup = Get_Supplier_Name($row); print qq(<td align="center" bgcolor="#7E7E7E" colspan="2"><b>$ +sup</b></td>); } print qq(</tr><tr><td align="center" bgcolor="#7E7E7E"><b>Product Name +</b></td>); print qq(<td align="center" bgcolor="#7E7E7E"><b>Flag</b></td>); foreach my $row (@total_sup) { print qq(<td align="center" bgcolor="#7E7E7E"><b>Front End</b> +</td>); print qq(<td align="center" bgcolor="#7E7E7E"><b>Solid Sales</ +b></td>); } print qq(</tr>); foreach my $row (@total_pid) { my $sups = scalar(@total_sup); my $prod_name = Get_Product_Name($row,$group); print qq(<tr><td align="center" bgcolor="#FFFFFF"><input type= +"hidden" name="prod_id" value="$row">$prod_name</td>); print qq(<td align="center" bgcolor="#FFFFFF"><input type="hid +den" name="flag" value="$rowhash{$row}{'FLAG'}">$rowhash{$row}{'FLAG' +}</td>); for (my $i=1;$i<=$sups;$i++) { print qq(<td align="center" bgcolor="#FFFFFF"><input t +ype="text" name="sup_f_$now_sup[$i-1]" value="$rowhash{$row}{$now_sup +[$i-1]}{'DATA_F'}" size="10"></td>); print qq(<td align="center" bgcolor="#FFFFFF"><input t +ype="text" name="sup_s_$now_sup[$i-1]" value="$rowhash{$row}{$now_sup +[$i-1]}{'DATA_S'}" size="10"></td>); } print qq(</tr>); } my $col_span = (scalar(@now_sup)*2)+2; print qq(<tr><td align="center" bgcolor="#7E7E7E" colspan="$col_span"> +<input type="submit" value=" SAVE "></td></tr>);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://610584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-23 16:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found