[Solved] Can I store query result of one field into different variables? if not then what should I do for that?


$query = mysql_query("select `subject` from `markssub1` where `sname`='$user' AND `sid`='$id'");

$subjects = [];

while($row = mysql_fetch_array($query))
{
    $subjects[] = $row['subject'];  
}

foreach($subjects as $subject){
    echo $subject . '\n';
}

3

solved Can I store query result of one field into different variables? if not then what should I do for that?