Need help in code please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BAMBO
Forum Newbie
Posts: 2
Joined: Sat Apr 18, 2015 9:15 am

Need help in code please

Post 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.
Attachments
Question3.JPG
BAMBO
Forum Newbie
Posts: 2
Joined: Sat Apr 18, 2015 9:15 am

Re: Need help in code please

Post 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>
Attachments
Capture.PNG
Post Reply