Is it possible in php
and mysql
to get the value from the table using a query and store the value in a variable and use the variable in where condition of another query, for example
$us = mysql_query("select regional from td_user where user_id='".$_SESSION['use_i']."'");
$us_row=mysql_fetch_row($us);
$reg = $us_row[`regional`] ;
now i have stored the value in a variable called $reg
$sql = "SELECT * FROM td_excel where regional = '$reg'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result)
{
<?php echo $row['Vehicle_description'];?>
<?php echo $row['Year'];?>
//it will display many rows like this
}
its not displaying any records!!!!,am i doing it in right way..please help me!!! P.S I am a learner!!