Mysql dual-cycle problems & lt; div & gt; & lt; dl & gt; & lt; dt & gt; & lt ;? Php & nbsp; $ strSql1 & nbsp; = "Select & nbsp; id & nbsp; From & nbsp; menu & nbsp; where & nb mysql dual-cycle problem
-
$ StrSql1 = "Select id From menu where subs_pid = '13' Order By time ASC limit 0, 11 ";
$ Res1 = _ query ($ strSql1 );
While (!! $ Rs = _ fetch_array ($ res1 )){
$ SubID = $ rs ['id'];
Echo "floor () \ n ";
}
Mysql_free_result ($ res1 );
?>
$ StrSql2 = "select pic1 from newslist where n_ppid = '". $ subID. "'Order by n_time desc limit 0, 12 ";
// $ SubID is the building material topic ID... how to cycle the building material topic ID through the first step.
?>
-
Ceiling product image
-
Doors and Windows product images
-
Floor product image
-
Home appliances
Attached image effects
There are html tags in the key. I am a newbie...
------ Solution --------------------
Okay, just follow your structure
Section 1
$ StrSql1 = "Select id From menu where subs_pid = '13' Order By time ASC limit 0, 11 ";
$ Res1 = _ query ($ strSql1 );
While (!! $ Rs = _ fetch_array ($ res1 )){
$ SubID [] = $ rs ['id']; // pay attention to this
Echo "floor () \ n ";
}
Mysql_free_result ($ res1 );
Section 2
Foreach ($ subID as $ id ){
Echo'
';
$ StrSql2 = "select pic1 from newslist where n_ppid = '". $ id. "'Order by n_time desc limit 0, 12 ";
// Here is the code for loop output image
Echo'
';
}