查询列出订单并返回产品

时间:2017-02-07 19:28:45

标签: php mysql

我需要一个查询来列出预算表的产品,但我的查询列出了所有请求,但没有列出请求中的相关产品。我需要帮助,谢谢你的帮助。

Screen image of Problem

Model Entity Relationship

计划屏幕



<!DOCTYPE html>

<html>
<head>
    <title>Project Web-View Cart</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../_css/layoutPrincipal.css">
    <link rel="stylesheet" href="../_css/formulario.css">
    <style>
	p{
	 font-family:"arial black";
	 font-size:15px;
	 margin: 10px 20px 20px 20px;
	  }
    </style>	
</head>
<body>

<header id="cabecalho">
    <img src="../_imagens/Logo.jpg">
</header>
<br class="fixFloat">
<nav id="menu">
    <ul>
        <li><a href="../index.html" target="_self">Home</a></li>
        <li><a href="../cadastra-se.html" target="_self">Register</a></li>
        <li><a href="../login.html" target="_self">Login</a></li>
    </ul>
</nav>


<section id="form">
    <?php
	
    session_start();
    $ID_Client = $_SESSION['ID_Client'];

    $connection = mysql_connect("localhost:3306","root","root") or die("Error while connecting the database");
    mysql_select_db("Provider",$connection);
    mysql_query("SET NAMES 'utf8'", $connection);
    mysql_query('SET character_set_connection=utf8', $connection);
    mysql_query('SET character_set_client=utf8', $connection);
    mysql_query('SET character_set_results=utf8', $connection);
	
    $Query= "select order.Service_Status,order.Type_Service,material.Product_Description,material.Amount,material.Unitary_value,material.Amount_Total,budget.Total_Budget from client join order on ClientID_Client='$ID_Client' join budget on ID_Order=OrderID_Order join material on ID_Budget=BudgetID_Budget where ID_Order >0";
   	$Result=mysql_query($Query,$connection) or die ("Could not query your data.");
    mysql_close($connection);

	
	  while($Query=mysql_fetch_array($Result)){
		  
		$Service_Status=$$Query["Service_Status"];		   
        $Type_Service=$$Query["Type_Service"];
		$Product_Description=$Query["Product_Description"];
        $Amount=$Query["Amount"];		
		$Unitary_value=$Query["Unitary_value"];
        $Amount_Total=$Query["Amount_Total"];
        $Total_Budget=$Query["Total_Budget"];	
	  
			  
		  echo "<fieldset id='form_field'><legend id='form_legend'>Order Details</legend>
 Service Status:$Service_Status<br/>Type Service:$Type_Service<br/><fieldset id='form_field'><legend id='form_legend'>List of Budget</legend>Product Description:$Product_Description<br/>Amount:$Amount<br/>Unitary_value:$Unitary_value<br/>Amount_Total:$Amount_Total<br/>Total_Budget:$Total_Budget</p></fieldset></fieldset>";
		
      }
		
          echo'<fieldset id="form_field">
        <legend id="form_legend">Back</legend>
        <a href="../menuclient.html" id="botao">Back</a>
    </fieldset>';
  
	  
	 ?>
    

</section>


</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案