Jump to content

poleposters

Members
  • Posts

    244
  • Joined

  • Last visited

    Never

About poleposters

  • Birthday 01/18/1983

Contact Methods

  • Website URL
    http://www.stickemup.net.au

Profile Information

  • Gender
    Male
  • Location
    Sydney

poleposters's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Also, if it makes it any easier. I'll be filtering the initial array in the sql query to remove peaches & pears etc.
  2. After a day of studying the code above I've finally figured out how it all works. But now I've encountered a new problem. How could I modify the code to allow me to store some information about each piece of fruit? e.g red apple, green apple, yellow banana This would not affect the way the fruit is sorted into bowls. A red or green apple could go into the bowl interchangeably. I would just like to be able to access the bowl array to determine whether the apple is green or red. Thanks!
  3. That's perfect thank you! I'm excited to study it and try and understand how it works. Arrays still boggle my mind. Thank you for your help.
  4. Sorry, I should of mentioned that. I want ignore pears and peaches. Where there is not enough fruit for a complete bowl. I'd like a NULL value in place of the missing fruit.
  5. Hi, I need some help getting my head around arrays. I have a basket of fruit: $basket=("Apple","$Orange","$Banana","$Banana","$Peach","$Apple","$Banana","$Orange","$Apple"); I want to distribute and share this basket of fruit into bowls, such that each bowl contains the following: $bowl=("$Apple",$Orange,"$Banana","$Banana") ie. One Apple, One Orange & Two Bananas. I can't seem to figure out how to do it. Thanks in advance.
  6. Hi, I have items A, B & C that belong to a bundle/kit. These items don't always arrive together in the same shipment. I want to be able to determine the soonest availability of each kit. I have an inventory table that looks like this. (One item per row. Shipment is usually a date. I've used integers to simplify the example) ITEMSHIPMENT A1 C1 C1 B2 B2 A3 A3 B3 C3 As you can see, the first complete kit becomes available in Shipment 2, The second complete kit in shipment 3, and the third complete kit also in shipment 3. Its pretty easy to work out in my head. But how do I do it with PHP/MYSQL?
  7. Hi. Can you post your login script? Your login script should create a $_SESSION variable. ie your admin username or something like that. Then at the top of every script that is admin only, you should check to see if this $_SESSION variable exists. If it doesn't, then redirect the user.
  8. Whoops! I've run into some trouble. I've changed the way I create the array and I can't seem to get it to work. I'm still getting my head around arrays and its still a bit confusing. I'm retrieving records from a database to create the array. Heres a snapshot of how the array is created. while($select=mysql_fetch_array($result)) { $arr[]=array($select['product'],$select['despatch_method']); } If the above solution can be modified to suit the way I create the array that would be great. Thank you!
  9. Hi, I've just recently discovered how useful writing my own php functions are. I've been using them mostly to tidy up repetitive code. However I want to know if this is possible. I have a mysql query which retrieves a customer's details from the database. I use it quite alot and want to place it inside a function. However I'm not sure how to return the values once the query is completed. I thought that the function might work similarly to an include, but this doesn't seem to be the case. Is a function the right way to go about this? $query="SELECT * FROM customers LEFT JOIN orders ON orders.customer_id=customers.customer_id LEFT JOIN contact ON contact.customer_id=customers.customer_id WHERE orders.order_id='$order_id'"; $result=mysql_query($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if(mysql_num_rows($result)>0) { while($select=mysql_fetch_array($result)) { $first_names=$select['first_name']; $email=addslashes($select['email']); $invoice_location=$select['invoice_location']; } }
  10. Hi, I have a form that is dynamically generated. It pulls a number of items from the database and presents each one with a select menu next to it. The select menu presents a number of options that apply to each individual item. ie ITEM_47---<select>-- ITEM_56---<select>-- ITEM_32---<select>-- ITEM_63---<select>-- Now the problem I have is that if I use the ITEM_ID as the name of each field I wont be able to process the form because the process script won't know how to refer to the $_POST data in order to capture it. However if I give he fields generic names, then I won't be able to link each select menu with an ITEM_ID. It seems like a pretty basic task. I'm certain there is a solution. Please let me know if I need to clarify. Thanks.
  11. Hi I have a multidimensional array. The first key is the name of the product and the second is the delivery method. Stuff | Truck Widgets | Courier Thingies | Post Doovas | Truck I want to creats a list like so. Your Stuff and Doovas will be delivered by truck Your Widgets will be delivered by Courier Your Thingies will be delivered by Post Is there a way to sort the array into goups according to one of the keys? Thanks
  12. Hi, I need to process a dynamically generated form. Its a list of items with an item_id and an editable shipment_id in a text field. I've been giving each text input the name field[] so that I can process the form on another page using this code $shipment_id=$_POST['field']; $n=count($shipment_id); for($i=0;$i<$n;$i++) { Do something } Except now I realise I can't use the item_id for each field. Is there a way around this?
  13. Hi, I want to export my database without having to go into phpMyAdmin. ie. I want to run a script which will output the database to an SQL file. Is there a way to do this?
×
×
  • 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.