hi guys,
i am trying to write a code that can actually get a value from one table and then use that value to run another SQL query,,, hmm.. i dun really know how to explain but i hope u guys can help..
can u guys help me to check why when i use something like $info.$i, it doesn’t have any value inside ? did i miss something here ? did i insert the variables wrongly ? can you guys let me know how i suppose to write in order to get the value i want .. i actually want it to loop for 10 times since i have 10 records for a user in page_info table.
this is the code that i wrote :
[CODE]
<?
// connect to db
include “../include/global.php”;
// navigation menu
$query2 = mysql_query(“SELECT * FROM `sorting` where `site_name` = ‘$site_name'”) or die(“Error occured”);
$row2 = mysql_fetch_array($query2);
for( $i = 1; $i < 11 ; $i++)
{
$info.$i = mysql_query(“SELECT * FROM page_info where `site_name` = ‘$site_name’ AND id = ‘{$row2[‘sort$i’]}'”) or die(“Error occured”);
$display.$i = mysql_fetch_array($info.$i);
//echo “$info.$i”;
//echo “|| $display.$i”;
}
echo $display1[‘name’];
echo $display2[‘name’];
..
.
?>
there is no output displayed and i received an error saying Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource.
please advise.. thanks.