Is there a nested while and 2 mysql_query?

I am having trouble with this code I made. I do not know if it is my fault…

Kindly check if there are flow error. Also is it possible to have a nested while and 2 mysql_query?

[php] include(“db.php”);
$tablename = “$_POST[fmodule]”;
$vdate = “$_POST[fdate]”;
$vprocess = “$_POST[fprocess]”;

$result_model=mysql_query("SELECT name FROM models WHERE module='" . $tablename . "'");
while($test_model = mysql_fetch_array($result_model)){
$vmodel = $test_model['name'];

echo $vmodel;
echo "<table border='1'>";
$result=mysql_query("SELECT * FROM " . $tablename . " WHERE Date='" . $vdate . "' AND ProcessType='" . $vprocess . "' 
						AND Model='" . $vmodel . "' ORDER BY `RecNo` DESC");	
[/php]

I don’t know if this is applicable.

All I want is to show all the data from the model and filter it by model.

Sample

model 1
Type ----- number ----- Model ----- Result
R 12 model1 OK
E 14 model1 NG
R 15 model1 OK
R 17 model1 NG

model 2
Type ----- number ----- Model ----- Result
R 13 model2 OK
E 16 model2 NG
R 18 model2 OK
R 20 model2 NG

model 3
Type ----- number ----- Model ----- Result
R 19 model3 OK

Hello

I been doing some experiment and it seems that this one is cause the problem.

[php]AND Model=’" . $vmodel . "’ [/php]

can I do a mysql_query and use the result as variable to do another query?

for some reason. The program is working now. I don’t really know what happen.

Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service