php中关联多张表的问题
前一张页面: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("Could not query.".mysql_error()) ;
$info=mysql_num_rows($mysql) ;
if($info==""){
$html_info="暂时没有订单。" ;
}
else{
$str=mysql_fetch_array($mysql) ;
$html_info="
" ;
}
?>
欢迎 登陆
链接后: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("Could not query.".mysql_error()) ;
$str=mysql_fetch_array($mysql) ;
$html_info="
" ;
do{
$html_info.="" ;
$html_info.="订单号 |
".$str["order_number"]." | " ;
$html_info.="
" ;
$html_info.="" ;
$html_info.="订单时间 |
".$str["order_date"]." | " ;
$html_info.="
" ;
$html_info.="" ;
$html_info.="订单状态 |
".$str["deal_information"]." | " ;
$html_info.="
" ;
}while($str=mysql_fetch_array($mysql)) ;
$html_info.="
" ;
?>
欢迎登陆
------解决方案-------------------- $sql="select * from order_table , deal_table where deal_table.order_id=order_table.order_id
and order_table.order_number='$order_number'" ; //缺少 where 的连接条件
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn