Jump to content

SeanHarding

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Everything posted by SeanHarding

  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.
  13. What format should my MySQL database be to store a multidimensional array? BIGTEXT, VARCHAR, utf8_unicode_ci?
  14. "SELECT gigs_ID, DATE_FORMAT(date, '%d/%m/%Y') as formatted_date, venue FROM tblGigs WHERE date > now() ORDER BY date ASC LIMIT 1"
  15. I could implode the array but i'm not sure how that would work... if i: implode('AND field ', $array); Its searching the database for the three arrays in one table field...
  16. I just need to display the contents of each field onto the page, relating to their id. Each value in the array will 100% be in the database.
  17. I have an array with 3 id's in it... currently i'm doing the following: $my_array(2, 4, 6); foreach ($my_array as $search) { $quer = "SELECT * FROM my_table WHERE id=$search LIMIT 1"; $run = mysqli_query($connect, $quer); while ($new_array = mysqli_fetch_array($run)) { //displaying results here } } Is there a better way of doing this instead of repeating my query? Am I in the wrong forum?
  18. Oooo are you looking for the hidden fields value? <input type="hidden" name="myhiddenfield" value="whatever you want in here"> to retrieve the hidden field: echo $_POST['myhiddenfield']; I could be completely wrong tho...
  19. Thats amazingly perfect thanks Samshel I updated the last bit to make it more 'me' friendly lol foreach ($doom as $k=>$v) { $serialz=serialize($v); $encode=urlencode($serialz); echo "<a href=\"http://www.web_site/Blog/archive.php?x=$encode\">$k</a><br />"; }
  20. <?php phpinfo(); ?> Place a file on your server with this code in it... it will display all information you need, dont keep it up for long tho... It raises security issues. Or if your server is a windows machine with a static IP address you can use the program 'Remote Desktop connection' to connect to your server.
  21. thanks for your post but... I need to list the months in my array and also link them. The results needed are the following: <a href="Blog?x=' array of October 08's numbers '">October 08 (2)</a> <a href="Blog?x=' array of February 07's numbers '">Febuary 07 (1)</a>
  22. Is it possible to create a multidimensional array to accomplish 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.