Hi im having a few problems with trying to get the coding right on a orders list ive done (or trying to do) for a custom shopping cart im making... For some reason it comes up with all the orders in stead of 1. i.e. If there i start from scratch ill have order number 1 which will have the order in but if i create another order it displays order number 2 twice with both the customers details on...
Heres the code:
Code: <?php
include ('../includes/db.php');
include('search.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Orders</title>
</head>
<body>
<a href="orders.php">Refresh</a> || <a href="admin.php">Back to Admin</a> <br/><br/>
<form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm">
<input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" />
<input type="submit" name="submit" value="Search!" /> ||
First Name: <input type="checkbox" name="firstname" value="on" <?php echo isset($_GET['firstname'])?"checked":''; ?> /> ||
Last Name: <input type="checkbox" name="lastname" value="on" <?php echo isset($_GET['lastname'])?"checked":''; ?> /> ||
House Name: <input type="checkbox" name="address1" value="on" <?php echo isset($_GET['address1'])?"checked":''; ?> /> ||
Post Code: <input type="checkbox" name="zip" value="on" <?php echo isset($_GET['zip'])?"checked":''; ?> />
</form>
<br />
<?php echo (count($error) > 0)?"The following had errors:<br /><span id="error">" . implode("<br />", $error) . "</span><br /><br />":""; ?>
<?php echo (count($results) > 0)?"Your search for '{$searchTerms}' returned:<br /><br />" . implode("", $results):""; ?>
<?php
$result = mysql_query("SELECT * FROM customers INNER JOIN order_detail ORDER BY orderid DESC");
echo "<table border='1'>
<tr>
<th>Order Number</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Address 1</th>
<th>Address 2</th>
<th>City</th>
<th>State</th>
<th>Post Code</th>
<th>Phone</th>
<th>Payment</th>
<th>Price</th>
<th>Total</th>
<th>Payed</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['orderid'] . "</td>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['address1'] . "</td>";
echo "<td>" . $row['address2'] . "</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['state'] . "</td>";
echo "<td>" . $row['zip'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['payment'] . "</td>";
echo "<td>£" . $row['price'] . "</td>";
echo "<td>£" . $row['total'] . "</td>";
echo "<td>" . $row['payed'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>
</body>
</html>
Im completely stuck on this as im no php or mysql gurru...
so any help or info would be greatfull..
Cannot Display Array from Select Statement + Login question
Hi,I'm new to PHP but so far so goog. I was assigend a project and I'm very close to completion. I have a site that logs you in, sets a cookie, and then what I would like to do is depending on the
Using CSS to format MySQL query
Hi,If i want to have a news page on my site, which displays all records of a table in descending order by date I am using the below code. I can display it all in a big table but this is a bit boring.
php wont update my db
hello,sorry for posting in mysql forum but i dont know where exactly is the problem but here is the linkhttp://www.phpfreaks.com/forums/index.php/topic,272737.0.htm
Using real time in php
I'm very average at PHP and im looking to introduce time to something on my site.Its a sports site and everyone has fixtures. I have them so they are created and put into a table, what I now want to
FTP issues
Hi all,I am currently facing some serious problems with a script and really need some advise before I am actually sick To give you a brief overview of the situation, I have a script which is going to
Problem with DB connection
Hello there! I'm new to this forum and I'm new to PHP coding also. I wrote something that doesn't make exactly what I thought it will. Can you give me a hand please. There we go:Code: [Select]
While Problem
i am having a problem with a while statement here is the code Code:
Is this Safe or Unsafe?
Hi i made a few pages with lots of peoples help now i just want to know if they are safe or not can anyone help me?here are the codesRegisterCode: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
Help with PHP Email Script
Hi guys,I'm a newbie to php and need help with the script below:At the moment when I receive the automated email of data, I'm not receiving any information with the form field names I receive blank
temporary objects
Until now i thought every temporary object in C++ is created as constant. I'm wondering why my compiler (gcc) is reporting an error on line k.f();, but not g().f(); and g() = k;. Does anyone