Related issues of associating multiple tables in php

Source: Internet
Author: User
The previous page for associating multiple tables in php: rem_list.php & lt; html & gt; & nbsp; & lt; head & gt; & nbsp; & lt; title & gt; & lt;/title & gt; & nbsp; & lt;/head & gt; & nbsp; & lt; body & gt; & nbsp; & lt ;? Association of multiple tables in php
Previous Page: rem_list.php
 

 

 
Session_start ();
Include_once ("../include/conn. php ");
$ Rem_id = $ _ SESSION ["rem_id"];
$ Rem_name = $ _ SESSION ["rem_name"];
$ SQL = "select order_number from rem_table, order_table where rem_table.rem_id = order_table.rem_id and rem_table.rem_name = '$ rem_name '";
$ Mysql = mysql_query ($ SQL) or die ("cocould not query.". mysql_error ());
$ Info = mysql_num_rows ($ mysql );
If ($ info = ""){
$ Html_info = "There are no orders currently. ";
}
Else {
$ Str = mysql_fetch_array ($ mysql );
$ Html_info ="
    ";
    Do {
    $ Html_info. ="
  • ". $ Str [" order_number "]."
  • ";
    } While ($ str = mysql_fetch_array ($ mysql ));
    $ Html_info. ="
";
}
?>


Welcome Login




 


After the link: order_list.php
 

 

 
Session_start ();
Include_once ("../include/conn. php ");
$ Order_number = $ _ GET ["order_number"];
$ Rem_name = $ _ SESSION ["rem_name"];
$ SQL = "select * from order_table, deal_table where deal_table.order_id = order_table.order_id, order_table.order_number = '$ order_number '";
// Var_dump ($ SQL );
$ Mysql = mysql_query ($ SQL) or die ("cocould not query.". mysql_error ());
$ Str = mysql_fetch_array ($ mysql );
$ Html_info =" ";
Do {
$ Html_info. ="";
$ Html_info. ="Order No.". $ Str [" order_number "]."";
$ Html_info. ="";
$ Html_info. ="";
$ Html_info. ="Order time". $ Str [" order_date "]."";
$ Html_info. ="";
$ Html_info. ="";
$ Html_info. ="Order Status". $ Str [" deal_information "]."";
$ Html_info. ="";
} While ($ str = mysql_fetch_array ($ mysql ));
$ Html_info. ="";
?>


Welcome Login




 

------ Solution --------------------
$ SQL = "select * from order_table, deal_table where deal_table.order_id = order_table.order_id and order_table.order_number = '$ order_number'"; // The connection condition for where is missing

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.