Page 1 of 1

Need help in code please

Posted: Sat Apr 18, 2015 9:25 am
by BAMBO
attached is the question. I wrote the answer code, but it looks like something is wrong.
It has some small errors and the output is not exactly correct. Need your help please.

Re: Need help in code please

Posted: Sat Apr 18, 2015 9:27 am
by BAMBO
This is my code and output:

<?php
$sql=mysqli_connect("localhost","root","","a");
$show= "SELECT Item_name , Quantity ,Order_Date FROM order_items JOIN orders ON order_items.Order_Id=orders.Order_Id WHERE orders.Order_Id='".$_POST['num']."'";
$showq=mysqli_query($sql,$show);
$dateq=mysqli_query($sql,$show);
?>


<html>
<head>
</head>
<body>
<form action="three.php" method="POST">
<p>
<lable>Enter Order number:</lable>
<input type="text" name="num">
</p>
<input type="submit" name="submit">

</form>

<p>Order Number:<?php print $_POST['num']?></p>
<p>Order_date:<?php $date = mysqli_fetch_array($dateq,MYSQL_ASSOC);
print $date['Order_Date']; ?></p>
<table cellpadding="2" border="4">
<?php
if($showq){
while($info = mysqli_fetch_array($showq,MYSQL_ASSOC)){
echo'<tr>';
echo'<td>';
echo $info['Item_name'];
echo'</td>';
echo'<td>';
echo $info['Quantity'];
echo'</td>';
echo '</tr>';

}
}
?>
</table>
</body>

</html>