Jump to content

seanty

New Members
  • Posts

    4
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

seanty's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm looking to create a 'for fun' system (I suppose to help me learn too) for an invitation system. What I'm going to have is a php registration page linked with a mySQL db where a user can 'sign up' and add their details. From the admin side i can then 'approve' certain users. Upon approval, their data is 'printed' onto a background image of a ticket (that ive already created) then saved as an image file. The user is then sent a link with the image file so that they can print their ticket (which may include QR code). Basically a bit of a fun project.. I am ok with the php/mySQL registration/approval stuff... its the process of getting the MySQL data 'printed' onto an existing image (blank invitation). Any ideas?
  2. This is the perfect example of how simple errors can bring things to a halt when learning something new. I was literally staring at the screen for hours and assuming there was something fundamentally wrong with calling a table inside another without having relationships setup. Thanks so much for your reply - i have the " and ' embedded in my brain now in the php folder.. I noticed these but hadn't really thought about the difference between the two in this context. From reading around I gathered that different flavours of mySQL are now the norm and I will definitely go that way before doing anything thats going 'live'
  3. Sorry I had been changing stuff there.. that second while loop should read: while ($get_order_row = mysql_fetch_assoc($get_order)){ $currentitem = $get_order_row['itemid']; $currentitemqty = $get_order_row['qty']; echo "Item# $currentitem Qty:$currentitemqty"; }//end while Still same error though. Any help much appreciated!
  4. I'm a newbie to PHP and mySQL. Doing a simple on-line restaurant ordering system for a project. With consideration to 2 tables that I have: - ORDERS - holds orderid(primary key), userid(primary key in user table), total(total for billing), complete(flag for staff to set order as complete when processed), date - ORDERSITIMISED - holds id(primary key), orderid(the key of ORDERS table), itemid(primary key in items table), and qty I'm trying to have a loop which goes through each order in ORDERS and prints it to screen if its not set to 'COMPLETE' Within each loop iteration I want to print the ordercontents from ORDERSITIMISED with orderid's that match the one in the main loop I can print the list of orders no problem but having difficulty with printing the itemised list for each iteration. This is the error i get: I've been trying various things and reading a good few tutorials but I'm obviously missing something fundamental here. Would i need to setup a join between tables and create a different query? Code below: <?php session_start(); require('connect.php'); if ((@$_SESSION['adminflag'])==1){ //checks if adminflag is set to 1 echo "Welcome, ".$_SESSION['username']." to the live order view!<br><a href='logout.php'>Click here</a> to logout."; echo "<h1>Live Orders</h1>"; //display orders //get orders from orders table that are NOT complete $get = mysql_query('SELECT * FROM orders WHERE complete=0'); if (mysql_num_rows($get)==0){ echo "<p>There are no active orders to display."; } else{ //for each order in the order table that is NOT complete... while ($get_row = mysql_fetch_assoc($get)){ //extract user id and order id to be used to query other tables $currentuserid = $get_row['userid']; $currentorderid = $get_row['id']; //print order id, date/time, and total due echo "Order Number: $currentorderid. Timestamp: ".$get_row['date'].". Total Due: £".number_format($get_row['total'],2)."<p>"; //now for each iteration of the above while look, get all items from table 'ordersitemised' that have that orderid $get_order = mysql_query('SELECT * FROM ordersitimised WHERE orderid=$currentorderid'); if (mysql_num_rows($get_order)==0){ echo "<p>No order details found for order# $currentorderid"; } else{ while ($get_order_row = mysql_fetch_assoc($get_order)){ $currentitem = $get_details['itemid']; $currentitemqty = $get_details['qty']; echo "Item# $currentitem Qty:$currentitemqty"; }//end while } //end else }//end while }//end else }//end if else{ //display unauthenticated message die("You do not have permission to access this page!"); } ?>
×
×
  • 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.