my ($id, $username); my $sth = $dbh->prepare_cached(<<SQL); Select id, username From members SQL $sth->execute(); $sth->bind_columns(undef, \$id, \$username); #category queries my ($count); my $sthx = $dbh->prepare_cached(<<SQL); SELECT COUNT(*) From Results WHERE user_id = ? AND read = '2' SQL my ($count_v); my $sthv = $dbh->prepare_cached(<<SQL); SELECT COUNT(*) From Results WHERE user_id = ? AND read = '3' SQL my ($count_c); my $sthc = $dbh->prepare_cached(<<SQL); SELECT COUNT(*) From Results WHERE user_id = ? AND read = '4' SQL my ($count_e); my $sthe = $dbh->prepare_cached(<<SQL); SELECT COUNT(*) From Results WHERE user_id = ? AND pending = 'p' SQL my ($count_m); my $sthm = $dbh->prepare_cached(<<SQL); SELECT COUNT(*) From Results WHERE user_id = ? AND requests > 5 SQL my ($count_w); my $sthw = $dbh->prepare_cached(<<SQL); SELECT COUNT(*) From Results WHERE user_id = ? AND votes > 0 SQL # while $sth->fetch() { $sthx->execute($id); $sthx->bind_columns(undef, \$count); $sthx->fetch(); print "<td>$count</td>"; $sthv->execute($id); $sthv->bind_columns(undef, \$count_v); $sthv->fetch(); print "<td>$count_v</td>"; #etc...etc.. until all sth's are executed. #going to add a limit to the # of members to fetch, perhaps #100 membe +rs a page....if thats the case: # #1 select query to fetch all 100 member id's. #6 selects for each member, x 100 members so 600 queries to #print out + the table full of values. #total to 601 select queries } <br><br> Thanks, Bobby
In reply to Re: How many Select Querie is considered too much?
by Anonymous Monk
in thread How many Select Querie is considered too much?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |