php - show all orders made by one user -


<?php include_once 'db.php'; $email = $_get['email']; $order_id = $_get['order_id']; $res=mysql_query("select * clients_buy email='$email'"); $row=mysql_fetch_array($res); echo "<table border='1'> <tr> <th><center>order_id</center></th> <th><center>item1</th> <th><center>item2</th> <th><center>item3</th> <th><center>item4</th> <th><center>item5</th> </tr>"; while($row = mysql_fetch_assoc($res)) $row[] = $row; echo "<tr>"; echo "<td><center>" . $row['user_id'] . "</center></td>"; echo "<td><center>" . $row['item1'] . "</center></td>"; echo "<td><center>" . $row['item2'] . "</center></td>"; echo "<td><center>" . $row['item3'] . "</center></td>"; echo "<td><center>" . $row['item4'] . "</center></td>"; echo "<td><center>" . $row['item5'] . "</center></td>"; echo '</tr>'; echo '</table>'; ?> 

i want show in php page orders made 1 user.

as sand commented, please use mysqli or pdo. how come don't have curly braces on while loop? seems course mistake though have not tested code. write

while($row = mysql_fetch_assoc($res)){        echo "<tr>";     echo "<td><center>" . $row['user_id'] . "</center></td>";     echo "<td><center>" . $row['item1'] . "</center></td>";     echo "<td><center>" . $row['item2'] . "</center></td>";     echo "<td><center>" . $row['item3'] . "</center></td>";     echo "<td><center>" . $row['item4'] . "</center></td>";     echo "<td><center>" . $row['item5'] . "</center></td>";     echo '</tr>'; } echo '</table>'; 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -