Jump to content


Photo

array question


  • Please log in to reply
2 replies to this topic

#1 levivel

levivel
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 24 August 2006 - 06:40 AM

Hello,

My task is to read a list of values from MySQL, compare it to a list from an array, ignore the values that exist both in the MySQL list and the array list, and select a random value from the remaining array. I've found functinos like array_slice, array_rand, multisort_array, but I can't seem to be able to put together the whole picture. Could anyone point me in the right direction?

Thanks very much,
Levi

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 24 August 2006 - 06:47 AM

http://www.php.net/in_array checks if a value is in an array

http://www.php.net/unset will remove array elements

http://www.php.net/array_rand will return a key at random from the remaining array

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 levivel

levivel
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 24 August 2006 - 06:52 AM

wow thank you - I'll get right on this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users