Jump to content

High_-_Tek

Members
  • Posts

    72
  • Joined

  • Last visited

    Never

Everything posted by High_-_Tek

  1. Ok, I am trying to list the Invoice Number and a link to that invoice record as well as a subtotal next to it in the next table Thanks :)
  2. Hey Guys! Thanks for the help :) But now I get random duplication ... some have 6 copies, some have 2, one has 1 copy
  3. Hey All, I have this query which sets up a table of Invoice Numbers and Sub Totals, but even when I use the DISTINCT command, I get duplicates I believe this is because I get the Invoice_# pulled from the Order_Details table (which is boudn to hold doubles because it containts the product ids). But when I cut that part out and only have it 'WHERE' info from the Order table it repeats every single Invoice_Number in a loop :( FOr example I have two entries for invoice 3 that Im looking at [code] $month=$_SESSION['month'];// Old Way of Doing it $custid=$_SESSION['custid']; $year=$_SESSION['year']; // $sql_orders=mysql_query("SELECT DISTINCT Orders.Invoice_Number AS InvoiceID, Orders.Subtotal AS sub, categories.catname AS CatName FROM Invoice_Record AS ir, Orders, Order_Details, Customers,Products, categories WHERE Orders.Customer_ID='$custid' AND Orders.month='$month' AND ir.month='$month' AND Orders.year='$year' AND Orders.Customer_ID=Customers.customerid AND categories.catid=Products.Product_Cat_ID AND Order_Details.Product_ID=Products.Product_ID AND Orders.Invoice_Number=Order_Details.Invoice_Number") OR DIE (mysql_error()); // ... while ($order=mysql_fetch_array($sql_orders)){   //$total=$order['price'] * $order['quan'];   //$subtotal+=$total;   //$invoice=$order['InvoiceID'];   echo "<tr><td><a href=\"invoice3.php?custid=$custid&orderid={$order['InvoiceID']}\">{$order['InvoiceID']}</a><td>£{$order['sub']}</td></tr>";   $subtotal+=$order['sub']; } [/code] Thanks for any help PHPFreak is my homie!
  4. Thank You so much barand :) We are soo close :). The tax added into the subtotal is spot on, but the tax LISTED off off by a few dollars. Is there a way to splice the tax off when its added to the sub_total? Because only the LISTED tax is off and not the tax added to the total BTW~ Here is what is outputted 5 2.00 3.32 10 4.00 3.32 12 2.00 3.32 42 1.18 0.21 43 11.75 2.06 Total 20.93 12.24 The tax is supposed to be 1.93 Thank You Again :)
  5. Ok when I run the script I get this: 36 10.00 2.71 42 6.46 1.13 Warning: printf(): Too few arguments in /home/www/petalfoods.com/Test/order5.php on line 180
  6. Ok, That worked great :) But now I get this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #11' at line 1 Thanks again!
  7. Hey Barand thanks for that :) But when i run I get this: Parse error: parse error, unexpected '=' in /home/www/petalfoods.com/Test/order5.php on line 155 Which is probably attribuatted to this line: [code] $subTotal = vatTotal = 0; (156) is the line [/code] Thanks again
  8. <input type='password' name='xyz' />
  9. Well this goes pretty far as to hiding $_SESSION values [code] // To set the var $_SESSION['var']=base64_encode('haaaaaxxxx!'); // To Access $var=base64_decode($_SESSION['var']); [/code]
  10. Ignore all commented-out lines :D And I was advised by another member to add the while loop in there
  11. Hey All, I have a page for my company that needs fixing, I am so tired right now I cant think straight. But anyway, if a product(s) selected are under a certain catagory, then they need to add TAX But the way it is working now, it still adds tax for non-tax items. Code: [code] foreach ($_SESSION['purchase_prods'] AS $arr){     $price=$arr[1] * $arr[2];     $sql=mysql_query("SELECT cat.catid AS catid FROM Products AS p, categories AS cat WHERE p.Product_ID='$arr[0]' AND p.Product_Cat_ID=cat.catid");     $result=mysql_fetch_array(mysql_query("SELECT cat.catid AS catid FROM Products AS p, categories AS cat WHERE p.Product_ID='$arr[0]' AND p.Product_Cat_ID=cat.catid")) OR DIE (mysql_error());          define('TAX_AMNT',.175);     while(list($needsTAX,$price)=mysql_fetch_row($sql)) {         $sub_total+=$price;         if ($result['catid'] == 2) {             $sub_total+=$price * TAX_AMNT;             $vat=(TAX_AMNT * $sub_total);             }         //var_dump($needsTAX);     }     $vat=number_format($vat,2,'.','');   } [/code] Any and all help is very much appriciated :)
  12. Yes
  13. Ninja, I read your topic at the PHP Dev Network, and you apperantly didnt take any of our advice seriosuly. You should read and play with a few PHP books before trying to take on MySpace.. For future reference: [a href=\"http://forums.devnetwork.net/viewtopic.php?t=44873\" target=\"_blank\"]http://forums.devnetwork.net/viewtopic.php?t=44873[/a]
  14. Hey Hey Ya'll, I have written a 'confirm shipped' script for a company and even though I KNOW there is more than 1 row that should be returning... Yet it only returns one... Code: [code] <?php session_start(); session_regenerate_id(); include('connect.php'); if (!$_SESSION['is_admin']){   header("Location: admin_login.php");   die();    } if ($_GET['orderid']){   $oid=$_GET['orderid']; }else{   $oid=$_POST['orderid']; } if (isset($_POST['submit'])){      if (isset($_POST['Y'])){    $sql=mysql_query("UPDATE Orders SET dispatched='1' WHERE Invoice_Number='$oid'");    echo "Thank You, The Order has Been Confirmed Shipped";     }else{   die('Stopped'); } } $get=mysql_query("SELECT p.Name AS name, o.Subtotal AS sub, od.Price AS price, od.Quantity AS quan FROM Products AS p, Order_Details AS od, Orders as o WHERE o.Invoice_Number='$oid' AND o.Invoice_Number=od.Invoice_Number AND od.Product_ID=p.Product_ID") OR DIE (mysql_error()); echo "<table border='.5'> <tr><td><b>Product</b></td><td><b>Price</b></td><td><b>Quantity</b></td></tr>"; while ($row=mysql_fetch_array($get)){   echo "<tr><td>{$row['name']}</td><td>{$row['price']}</td><td>{$row['quan']}</td></tr>"; } echo "</table><br /> <form method='POST' action=\"$PHP_SELF\"> <b>Confirm?</b>&nbsp;&nbsp;&nbsp;&nbsp;<b>Yes:</b><input type='checkbox' name='Y'><br / <b>No:</b><input type='checkbox' name='N'><br /> <input type='submit' name='submit' value='Confirm'> <input type='hidden' name='orderid' value=\"$oid\"></form><br /> <a href='ManagersMainMenu.php'>Main Menu</a>"; ?> [/code] SQL Schema: `Orders` Invoice_Number Customer_ID Date_Ordered Delivery_date VAT Subtotal month year dispatched `Order_Details` Invoice_Number Product_ID Price Quantity Thank You :)
  15. [code] $tempuser = $user$a; [/code] TO [code] $tempuser = $user . $a; [/code]
  16. Yea, Hire someone to do it for you :P
  17. You had the ?> backwards [code] value="<?php echo $link; ?>" [/code]
  18. [code] if ($row['important'] == "yes"){ $icon = "$template_path/images/important.gif"; } if ($row['Locked'] == 1){ $icon = "$template_path/images/locked_topic.gif"; }elseif ($row['Type'] == "Poll"){ $icon = "$template_path/images/poll.gif"; }elseif ($read_status == "new"){ $icon = "$template_path/images/new.gif"; }elseif ($read_status == "old"){ $icon = "$template_path/images/old.gif"; }elseif ($reply_num >= 10){ $icon = "$template_path/images/hottopic.gif"; } [/code] Not tested
  19. :)
  20. change that line to: [code] <?php include('submission-formhandler.php'); ?> [/code]
  21. Well, the cheap way to do it would be this (before you put it in a INSERT query): [code] if ($var1 > 200){ die('Input is too big!'); } [/code] :D
×
×
  • 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.