Jump to content

TGM

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TGM's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. nice works now...jus one last question how would I display all orders made on a month...would changing the Interval be best way to do it.
  2. tnx it works but still doesnt give me what I want..It still displays all the orders from different days. $result = mysql_query ("SELECT * FROM orders WHERE DATE_SUB(CURDATE(), INTERVAL 1 DAY) <= `date_time` ");
  3. THis works but is doing it manually and it only displays 1 order.. Im trying to display all orders made by a day. example display all orders made on '2009-05-10' $result = mysql_query ("SELECT * FROM orders WHERE `date_time`='2009-05-10 03:36:02' ");
  4. date_time -->is the field name on my table
  5. $result = mysql_query ("SELECT * FROM orders WHERE date_time(CURDATE(), INTERVAL 1 DAY) <= date "); This one below work but it displays all orders and I want on orders made per day! $result = mysql_query ("SELECT * FROM orders ORDER BY `date_time` ");
  6. doesnt work...any other way how to do it
  7. I have a restaurant database and I want to display the all the orders made by the day. How can I report all orders made by the day using the date. On my order table I have a date/time that shows the time n date of the order made...
  8. still doesnt work...all other info is being stored except the date..it only stores 000-00-00.
  9. I want to insert date from page to mysql: This is what I got but does work <?php $hostname = "localhost"; $db_user = "root"; $db_password = ""; $database = "users"; $db_table = "orders"; $db = mysql_connect($hostname, $db_user, $db_password); mysql_select_db($database,$db); $query_auto = "INSERT INTO $db_table (date) VALUE ( CURDATE() )"; ?> I have a table name orders...in that table I have a date column but it only store "0000-00-00"
  10. aight this is what I got <?php $result = mysql_query("SELECT * FROM orders ORDER BY `id` DESC LIMIT 1"); echo "<table border='1'> <tr> <th>Item</th> <th>Quanity</th> <th>Price per unit</th> <th>Extra</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['item'] . "</td>"; echo "<td>" . $row['quanity'] . "</td>"; //yes its quanity not quality echo "<td>" . $row['price'] . "</td>"; echo "<td>" . $row['extra'] . "</td>"; echo "</tr>"; } echo "</table>"; echo"<br><div align='center'><em>YOUR TOTAL BILL IS:</em></div> <HR WIDTH='75%' SIZE='3' NOSHADE><br />"; //option 1 $result = $row['quanity'] * $row['price']; //doesnt work...outputs 0 //option 2 $result = $quanity * $price; //doesnt work..says Undefined variable: price echo "<p>Bill: $result</p>"; mysql_close($db); ?> It displays the last order but doesnt displays the calculation..for example if an item cost price= 2.25 and amount=2 should be 2.50 (i tink!lol) the option 1 code gives 0 and the option 2 gives an error..how can I read the value from the 'price' and the 'quantity' field?
  11. referring again with to the restaurant db. I want to calculate the total price for the order. how can I calculate the total price of an order..I know its 'amount' x 'quantity' but how to code this..
  12. THANX a lot premiso..it work. im new at mysql and php!!tnx very much!!
  13. THanks Maq it works and sorry for posting it on this section...i accidentally posted it on this section..i thought it was the php help section!..mah bad!
  14. im working on a simple restaurant db..I have an order page where you select the food item, quantity and show the price. When you click on Submit button it directs you to the another page where it should display the food you order and the bill... On my order Table it has (id, category, item, price, amount)the Id is my primary key and auto-increments. I have a query that display the item and the price on a html table BUT its displays ALL orders made AND NOT THE RECENT ORDER MADE..my problem is how to display that specific order.. <?php $result = mysql_query("SELECT * FROM orders"); echo "<table border='1'> <tr> <th>Item</th> <th>Price</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['item'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($db); ?>
  15. Well I was thinking the Id would uniquely represent an order BUT i have it as auto-increment. I think the date wouldn't be a wise idea because what on a certain day many Orders are made. What I want to display is the last order made. Display the order of only one customer not the order of many customers with in a day. my query is as fallows:: <?php $hostname = "localhost"; $db_user = "root"; $db_password = ""; $database = "users"; $db = mysql_connect($hostname, $db_user, $db_password); mysql_select_db($database,$db); ?> <html > <head></head> <body> <div id="body"><div id="content"><div class="i"> <div align="center"><em>Your Order Is:</em></div> <HR WIDTH="75%" SIZE="3" NOSHADE><br /> <?php [color=red]$result = mysql_query("SELECT * FROM orders");[/color] echo "<table border='1'> <tr> <th>Item</th> <th>Price</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['item'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($db); ?> </body></html>
×
×
  • 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.