I'm re-doing a 'view order history' since the old way was more of a manual process as opposed to automated.
Anyway, I've come to a point i've not used before in php . might sound odd, but i havent.
I have a user_order_history SQL db
I can echo it back and its all working great as long as it only makes one user_id call.
I need it to display a formatted output for each indvidual order history block of information.
So that user can see every block of order history with date and it is seperated to be neat and not all running in
one mass.
I've looked over the codes and php.net and not coming across the way to finish this code, not sure if this is what i need.
here's what i have so far
Code: Select all
<?php
session_start();
$_SESSION['user_id'] = 34 ;
require('connect/mysql_connect.php');
$sql = "SELECT * FROM user_order_history WHERE user_id = " . $_SESSION['user_id'] ;
$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);
// set variables.
$user_id = $_SESSION['user_id'];
$product1 = $row['product1'];
$attribute1 = $row['attribute1'];
$attribute2 = $row['attribute2'];
$attribute3 = $row['attribute3'];
$attribute4 = $row['attribute4'];
$date = $row['date'];
//echo variables to see they're working.
echo $product1;
echo $attribute1 ;
echo $attribute2 ;
echo $attribute3 ;
echo $attribute4 ;
?>
<?php
// TROUBLE SPOT
$order_history_items = count($row['user_id']);
$total = 0;
if ($items == 0){
echo "There are currently no items in your Order history.";
} else {
for ($cnt=0; $cnt < $items; $cnt++)
// ????? run out of brain juice