Mysql dual-cycle problems

Source: Internet
Author: User
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'
';
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.