best way to prgram php and mysql query
- by air
most of times in our pages we need to print only 1 field value of table in loop. for example
<?php
for($i=1;$i<=mysql_num_rows($result);$i++)
{
echo $row['name'];
$sql1="select industry from table_industry where profid='".$row['prof']."'";
$result1=mysql_query($sql1);
$row1=mysql_fetch_array($result1);
echo $row1['industry']; ?>
}
?>
above is one PHP code just for example where we think that $row['prof'] carry value of profession ID and we print profession of each person.
for example we have 5000+ record in table and above loop will execute for 5000+ times
what will be the best way to print value of industry field from table table_industry
Same code which i write above ?
any other php code suggestion for faster execution and less use of resources?
Thanks