Jump to content

skinnyguy76

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

skinnyguy76's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Agreed. I'm just not skilled enough in PHP to know how to do that. I don't want to take any more of your time. Appreciate all the help.
  2. I think I'm getting it. Thanks for the help! My only other question would be can I somehow jump out of the php in the body to structure the tables, divs etc. with the echo's within. I'm used to just including "<?php echo $row_Recordset1['OrderBusiness']; ?>" within tables/divs. Here's what I have in my head code: <?php mysql_select_db($database_adventcms, $adventcms); //Create and run ONE query to get all the data needed $query_Recordset1 = "SELECT o.OrderID, o.OrderBusiness, o.OrderUserID, o.OrderDate, o.OrderShipped, o.OrderAmount, o.OrderShipName, o.OrderShipAddress, o.OrderShipAddress2, o.OrderCity, o.OrderState, o.OrderZip, o.OrderCountry, o.OrderPhone, o.OrderFax, o.OrderShipping, o.OrderTax, o.OrderEmail, o.OrderTrackingNumber, od.* FROM orders AS o LEFT JOIN orderdetails AS od ON od.DetailOrderID = o.OrderID WHERE o.OrderShipped = 1 ORDER BY o.OrderID"; $Recordset1 = mysql_query($query_Recordset1, $adventcms) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> And here's what I have in the body as a test: <?php if(!mysql_num_rows($Recordset1)) { echo "No records found"; } else { //Create flag to track change in Orders $lastOrderID = false; while($row = mysql_fetch_assoc($Recordset1)) { //Check if the order is different from last if($lastOrderID !== $row['OrderID']) { //This order is different from last. //Display the order info echo $row_Recordset1['OrderBusiness']; echo "<br />"; echo $row_Recordset1['OrderState']; echo "<br />"; echo $row_Recordset1['OrderAmount']; echo "<br />"; echo "<br />"; //Set flag so additional details of this order //don't display the order info again $lastOrderID = $row['OrderID']; } //Display the order details echo $row_Recordset1['DetailProductID']; echo "<br />"; echo $row_Recordset1['DetailPrice']; echo "<br />"; echo "<br />"; } } ?>
  3. That is the general direction I was thinking, but have no idea how to code that.
  4. I'm a designer who muddles in PHP when necessary and understand the basics of MySQL queries. I have an order details page generated with a WebAssist extension for Dreamweaver. My client wants to have a 'print page' that pulls ALL unprocessed orders to print, rather than pulling and printing them one at a time. I understand the two queries from the pertinent part of the page below, but I'm at a loss as to how to query both the order and all the order details (individual ordered items). I'm wondering if this is something I can handle, or I just need to hire a developer to help. Any suggestions would be appreciated. <?php $ParamOrderID_WADAorders = "-1"; if (isset($_GET['OrderID'])) { $ParamOrderID_WADAorders = $_GET['OrderID']; } $ParamSessionOrderID_WADAorders = "-1"; if (isset($_SESSION['WADA_Insert_orders'])) { $ParamSessionOrderID_WADAorders = $_SESSION['WADA_Insert_orders']; } $ParamOrderID2_WADAorders = "-1"; if (isset($_GET['OrderID'])) { $ParamOrderID2_WADAorders = $_GET['OrderID']; } mysql_select_db($database_adventcms, $adventcms); $query_WADAorders = sprintf("SELECT OrderID, OrderBusiness, OrderUserID, OrderDate, OrderShipped, OrderAmount, OrderShipName, OrderShipAddress, OrderShipAddress2, OrderCity, OrderState, OrderZip, OrderCountry, OrderPhone, OrderFax, OrderShipping, OrderTax, OrderEmail, OrderTrackingNumber FROM orders WHERE OrderID = %s OR ( -1= %s AND OrderID= %s)", GetSQLValueString($ParamOrderID_WADAorders, "int"),GetSQLValueString($ParamOrderID2_WADAorders, "int"),GetSQLValueString($ParamSessionOrderID_WADAorders, "int")); $WADAorders = mysql_query($query_WADAorders, $adventcms) or die(mysql_error()); $row_WADAorders = mysql_fetch_assoc($WADAorders); $totalRows_WADAorders = mysql_num_rows($WADAorders); $colname_rsOrderDetails = "-1"; if (isset($_GET['OrderID'])) { $colname_rsOrderDetails = $_GET['OrderID']; } mysql_select_db($database_adventcms, $adventcms); $query_rsOrderDetails = sprintf("SELECT * FROM orderdetails WHERE DetailOrderID = %s", GetSQLValueString($colname_rsOrderDetails, "int")); $rsOrderDetails = mysql_query($query_rsOrderDetails, $adventcms) or die(mysql_error()); $row_rsOrderDetails = mysql_fetch_assoc($rsOrderDetails); $totalRows_rsOrderDetails = mysql_num_rows($rsOrderDetails);?> mod edit: code in code tags please
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.