Consultation on the query output of a MYSQL + php linked list

Source: Internet
Author: User
Tags php mysql
Consultation on query and output of a linked list of MYSQL + php SQL php mysql select cms

Fields in table cms_archives15
Aid mediumint (8) UNSIGNED no 0
Subject varchar (255) gbk_chinese_ci no
Jumpurl varchar (120) gbk_chinese_ci no
Caid smallint (5) UNSIGNED no 0
Chid tinyint (3) UNSIGNED no 0
Mid mediumint (8) UNSIGNED no 0
Mname char (15) gbk_chinese_ci no
Ucid mediumint (8) UNSIGNED no 0
Author char (30) gbk_chinese_ci no
Source varchar (50) gbk_chinese_ci no
Abstract text gbk_chinese_ci no
Keywords char (100) gbk_chinese_ci no
Thumb varchar (255) gbk_chinese_ci no
Imgnum tinyint (3) UNSIGNED no 0
Letter char (2) gbk_chinese_ci no
Vieworder smallint (6) UNSIGNED not 500
Initdate int (10) no 0
Createdate int (10) UNSIGNED no 0
Updatedate int (10) UNSIGNED no 0
Refreshdate int (10) no 0
Enddate int (10) no 0
Checked tinyint (1) UNSIGNED no 0
Customurl varchar (100) gbk_chinese_ci no
Nowurl varchar (255) gbk_chinese_ci no
Clicks int (10) UNSIGNED no 0
Downs int (10) UNSIGNED no 0
Mclicks int (10) UNSIGNED no 0
Wclicks int (10) UNSIGNED no 0
Mdowns int (10) UNSIGNED no 0
Wdowns int (10) UNSIGNED no 0
Mplays int (10) UNSIGNED no 0
Wplays int (10) UNSIGNED no 0
Dpmid smallint (6) No-1
Plays int (10) UNSIGNED no 0
Dj float no 0
Dt varchar (40) gbk_chinese_ci no
Ggdt varchar (40) gbk_chinese_ci no
Dt_0 double no 0
Dt_1 double UNSIGNED no 0
Answercid mediumint (8) UNSIGNED no 0
Close tinyint (1) UNSIGNED no 0
Finishdate int (10) UNSIGNED no 0
Ccid1 smallint (6) UNSIGNED no 0
Ccid2 smallint (6) UNSIGNED no 0
Ccid3 smallint (6) UNSIGNED no 0
Ccid12 varchar (255) gbk_chinese_ci no
Ccid14 smallint (6) UNSIGNED no 0
Ccid18 smallint (6) UNSIGNED no 0
Pid3 mediumint (8) UNSIGNED no 0
Inorder3 smallint (6) UNSIGNED no 0
Incheck3 tinyint (1) UNSIGNED no 0
Aesfys int (10) UNSIGNED no 0
Aczfys int (10) UNSIGNED no 0
Lpczsl int (11) no 0
Lpesfsl int (11) no 0
Csjdj float no 0
Csjgz float no 0
Cspjj float UNSIGNED no 0
Czzdj float no 0
Czzgj float no 0
Czpjj float UNSIGNED no 0
Ahds int (10) UNSIGNED no 0
Azxs int (10) UNSIGNED no 0
Atps int (10) UNSIGNED no 0
Ahss int (10) UNSIGNED no 0
Adps int (10) UNSIGNED no 0
Adpf float UNSIGNED no 0
Ayss int (10) UNSIGNED no 0
Agzs int (10) UNSIGNED no
Pid5 mediumint (8) UNSIGNED no 0
Inorder5 smallint (6) UNSIGNED no 0
Incheck5 tinyint (1) UNSIGNED no 0
Pid6 mediumint (8) UNSIGNED no 0
Inorder6 smallint (6) UNSIGNED no 0
Incheck6 tinyint (1) UNSIGNED no 0
Color varchar (10) gbk_chinese_ci no
Relatedaid varchar (255) gbk_chinese_ci no
Ccid41 smallint (6) UNSIGNED no 0
Ccid51 smallint (6) UNSIGNED no 0
Ccid53 smallint (6) UNSIGNED no 0
Tid smallint (6) UNSIGNED no 0
Editorid mediumint (8) UNSIGNED no 0
Editor char (30) gbk_chinese_ci no
From_mid mediumint (8) UNSIGNED no 0
From_mname char (15) gbk_chinese_ci no
Needstatics varchar (255) gbk_chinese_ci no
Arctpls varchar (255) gbk_chinese_ci no
Awds int (10) UNSIGNED no 0
Atjs int (10) UNSIGNED no
Azbs int (10) UNSIGNED no 0
Ayxs int (10) UNSIGNED no
Ccid54 smallint (6) UNSIGNED no 0
Fields in table cms_archives_4
Field type sorting property Null default additional operations
Aid mediumint (8) UNSIGNED no 0
Address varchar (150) gbk_chinese_ci no
Xkzh varchar (100) gbk_chinese_ci no
Dfl varchar (20) gbk_chinese_ci no
Lhl varchar (20) gbk_chinese_ci no
Yjl varchar (10) gbk_chinese_ci no
Wygs varchar (50) gbk_chinese_ci no
Wyf varchar (50) gbk_chinese_ci no
Qtbz varchar (255) gbk_chinese_ci no
Kprq varchar (50) gbk_chinese_ci no
Jfrq varchar (50) gbk_chinese_ci no
Jzmj varchar (10) gbk_chinese_ci no
Zdmj varchar (10) gbk_chinese_ci no
Cksm varchar (100) gbk_chinese_ci no
Content text gbk_chinese_ci no
Xqjs text gbk_chinese_ci no
Loupanlogo varchar (255) gbk_chinese_ci no
Lphf varchar (255) gbk_chinese_ci no
Tel varchar (100) gbk_chinese_ci no
Sldz varchar (255) gbk_chinese_ci no
Xqss varchar (150) gbk_chinese_ci no
Jtxl varchar (150) gbk_chinese_ci no
Zxcd int (10) no 0
Jgjj float no 0
Jdjj float no 0
Bdsm varchar (255) gbk_chinese_ci no
Ltbk varchar (255) gbk_chinese_ci no
Lpbbs varchar (10) gbk_chinese_ci no
Xqhs varchar (10) gbk_chinese_ci no
Jgdate int (10) no 0
Lppmtu varchar (255) gbk_chinese_ci no
Wydz varchar (200) gbk_chinese_ci no
Leixing varchar (1) gbk_chinese_ci no 0
Lcs varchar (10) gbk_chinese_ci no
Hxs int (10) no 0
Tslp varchar (255) gbk_chinese_ci no
Fkxs varchar (255) gbk_chinese_ci no
Lpxz varchar (255) gbk_chinese_ci no
Dtsm text gbk_chinese_ci no
Fields in table cms_housesrecords
Field type sorting property Null default additional operations
Cid int (10) UNSIGNED no auto_increment
Aid mediumint (9) UNSIGNED no
Isnew tinyint (1) No
Highest float UNSIGNED no
Average float UNSIGNED no
Lowest float UNSIGNED no
Message varchar (255) gbk_chinese_ci no
Createdate int (11) UNSIGNED no
The function to be implemented is that if the price recorded last time is higher than the price output in this record, the price will be the same → The price will be decreased
The following is the code.
$ SQL = "SELECT. 'aid ',. 'subobject' FROM cms_archives15 a left join cms_archives_4 c ON (c. aid =. aid) WHERE. caid = '2' AND. chid = '4' AND (c. leixing = '0' OR c. leixing = '1') AND 'cidr1' = '000000' order by. updatedate desc limit 0, 80 ";

$ Query = mysql_query ($ SQL );
While ($ arr = mysql_fetch_array ($ query )){
$ Jgsql = "select 'average' from 'cms _ housesrecords 'Where 'aid '= '". $ arr ['aid ']. "'Order by 'createdate' desc limit 2 ";

$ Jgquery = mysql_query ($ jgsql );
$ I = 0;
While ($ jgarr = mysql_fetch_array ($ jgquery )){
If ($ I <1 ){
$ F_jiage = $ jgarr ['average'];
} Else {
$ S_jiage = $ jgarr ['average'];
}
$ I ++;

}
If ($ f_jiage> $ s_jiage ){

$ Jgstyle = 'hangzhou ';

}
Elseif ($ f_jiage ==s_s_jiage ){

$ Jgstyle = '→ ';
} Else {

$ Jgstyle = 'hangzhou ';

}

?>


  • . Html "> RMB



  • }
    ?>

    The above is the query output of the price comparison I wrote, but it does not show anything. experts give pointers to me to see if there are missing fields or missing things?


    Reply to discussion (solution)

    Is there a large amount of information?

    Step-by-step debugging; output $ jgarr for a look, and then compare according to if.

    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.