Jump to content

6pandn21

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

6pandn21's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. An example data would be a shopping cart with item amount price pants 12 20 shirts 14 25 The actual string when echoed out is something like this; item id, item name, item price. (I left printing out the amount) &item_name_1=Baseball Mitt&item_name_2=Soccer Ball&item_name_3=Hockey Stick &amount_1=19.50&amount_2=25.00&amount_3=33.25 I hope that's what you were asking about.
  2. Hello everyone, I am building a simple shopping cart but my knowledge is somewhat limited in this area. So I have a query string for storing three different data; items_name, amount and price. $name_items_query_string .= '&item_name_' . $database_count . '=' . $item['name']; $price_items_query_string .= '&amount_' . $database_count . '=' . $item['price']; $qty_items_query_string .= '&quantity_' . $database_count . '=' . $item['qty']; So these string contains multiple items which I need to insert to my database table but I really have no knowledge unfortunately. I am thinking maybe I will need to explode the array and store them as comma separated file but that's just a shot in the dark. If anyone could show me some directions; like a tutorial or an example, it would be great. Thank you.
  3. Yes I am aware of what you said but I am just trying to show a very basic demonstration that something like this can be achieved with PHP. A full fledged application will be completely something else.
  4. First of all thank you for your suggestion. The idea behind $guest was to get the input guest amount by the user and add it up with current bookings if there were any on that day. For example an user enters 10 people for 30/11/2010. The script will get that 10 people and check if there is enough room for that day. So for that, it will take the 10 people and add it with the already booked people for that day. I will try to implement your suggestion and see what happens.
  5. Hello guys, I am trying to make a very simple booking system. The booking will be either for the current or the next year only. There are three fields; number of person, type of meal and date. In any particualr day and meal, the number of person can't exceed 100. When the user enters a date, number of people and meal type, the bookingcheck script should check if the booking is available. If it is available; it will allow the user to make a booking for that day and meal type. If there was no booking placed on that day, the script should insert the booking details. My problem is in the logic details, I am being unable to lay out the logic for this. If anyone could clarify, I would be grateful. Thank you. 6pand21 <?php $a = mysql_real_escape_string ($_POST['guest_number']); $b = mysql_real_escape_string ($_POST['date']); $c = mysql_real_escape_string ($_POST['food_type']); $exploded = explode("/", $b); $d = $exploded[0]; $e = $exploded[1]; $f = $exploded[2]; $year= date ("Y"); $nextyear= $year + 1; if (($f != $year) and ($f != $nextyear)) { echo"cannot book for this year"; } else { $result=mysql_query("SELECT * FROM booking WHERE year ='$f' AND food_type ='$c'"); while ($row= mysql_fetch_array($result)) { $guest = $row['guest_number'] + $a; if ($guest > 100) { //number of guest error } else { // continue with the booking } } } ?>
×
×
  • 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.