PHP - Too many mysql_query("SELECT .. ") .. ?
- by Mike
Hey, I'm making an e-shop and to display the tree of categories and all the products with their multiple variations of prices I made like more than 150 mysql_query("SELECT ..."); queries on one page. (If I count the "while" loops).
Is it too many, and if yes, can it have any negative effect? (ofc. it takes longer to load the data ..)
Also can I anyhow achieve the effect of this code without doing it that way?
$result2 = mysql_query("SELECT * FROM ceny WHERE produkt_id='$id' ORDER BY gramaz");
$result3 = mysql_query("SELECT * FROM ceny WHERE produkt_id='$id' ORDER BY gramaz");
$result4 = mysql_query("SELECT * FROM ceny WHERE produkt_id='$id' ORDER BY gramaz");
$result5 = mysql_query("SELECT * FROM ceny WHERE produkt_id='$id' ORDER BY gramaz");
while( $row2 = mysql_fetch_array( $result2 )) { }
while( $row3 = mysql_fetch_array( $result2 )) { }
while( $row4 = mysql_fetch_array( $result2 )) { }
while( $row5 = mysql_fetch_array( $result2 )) { }
Thanks, Mike.