Jump to content

SeanHarding

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

SeanHarding's Achievements

Member

Member (2/5)

0

Reputation

  1. INSERT INTO table1(id, chicken, beef, pork), table2(id, chickenid, cucumber) VALUES (NULL, '21', '22', '23', NULL, LAST_INSERT_ID(), '13') ??
  2. INSERT INTO table1(id, chicken, beef, pork), table2(id, lettuce, cucumber) VALUES (NULL, '21', '22','23', NULL, '12', '13'); Is there a way to retrieve the AUTO INCREMENT of table1 id and insert it into table2 lettuce all within MySQL code? I can do this in PhP by mysql_insert_id(); but that would mean two MySQL queries. Sorry if my query is written incorrectly, was just a passing thought.
  3. Its certainly an interesting project. I'm doing allot of math during the project and instead of creating multiple requests I'll be manipulating the array and storing it later.
  4. I need some help converting my captured array values into keys and later add arrays as the values. This might help explain what I'm looking for: I currently have Array ( [0] => Meat [1] => Veg ) But I'm after Array ( Meat => Veg => ) My end result will be: [Veg] => Array ( [Potatoe] => 12 [Cabbage] => 24 [Cucumber] => 56 ) [Meat] => Array ( [Chicken] => 23 [beef] => 90 ) I think either array_values() may help but I'm not too sure how to use it.
  5. Sorry for the long reply. I will be serializing my multidimensional array as the arrays are user generated. I would prefer to create and store arrays rather than create numerous tables in MySQL. With mb_strlen() does 1 character = 1byte? I'm assuming I'd use mb_strlen($string, '8 bit');
  6. Is there a way of detecting how big my unserialize() array is before I store it? TEXT will hold 65K and LONGTEXT will hold 4GB. If the string is too long I would like to reply with a message.
  7. Thanks Guys, I have been stuck on this for a while. Reading your reply I can see that I set the item as a Key and all I need is the Value. Thanks for your help. I may be back
  8. Have read quite allot about arrays but the multidimensional ones still confuse me. How about removing Cabbage completely?
  9. Worked perfectly. Is there a way to automate it? If I had numbered keys I'd use $i++ to run through them. Basically I need a total under my Veg and Meat section. If I'm updating the prices individually I'd like code to update the total. And how would I add Pork? lol
  10. Hi have an array() in which I would like to manipulate certain elements: Array ( [TESCO] => Array ( [Veg] => Array ( [Potatoe] => 12 [Cabbage] => 24 [Cucumber] => 56 ) [Meat] => Array ( [Chicken] => 54 [beef] => 89 ) ) [ASDA] => Array ( [Veg] => Array ( [Potatoe] => 12 [Cabbage] => 24 [Cucumber] => 56 ) [Meat] => Array ( [Chicken] => 23 [beef] => 90 ) ) ) How would I go about adding the price of my meat section together e.g. Chicken + Beef from ASDA = 113 Also how to add/remove elements from Meat/Veg? Like adding Pork Cheers
  11. Thanks fenway. I'm creating a user generated array() I think MySQL may have some issues if the site is creating allot of tables. But then again I'm having difficulties manipulating the arrays lol. Cheers
  12. I have waited 6 hours for that reply... thank you. I will be serialize() the information before it gets stored in the row-based database and unserialize() it when I retrieve it.
×
×
  • 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.