Jump to content


sql data into an array

  • Please log in to reply
1 reply to this topic

#1 kopander

  • New Members
  • Pip
  • Newbie
  • 6 posts
  • LocationFinland

Posted 06 July 2006 - 04:41 PM

Hi, new to this. Wondering if it is possible to enter figures from a mysql database into an array, which can be used on php functions? Example: so I have a function such as:
for ($i=0; $i<count($Values); $i++){ if ($Values[$i]>$max){$max=$Values[$i];} }
Which gets the values from a fixed array:

Now i'm trying to get the data from a database. But the problem I cant figure out how to change everything so it uses the data from the database without changing the functions.

I was wondering if there is a way to get the data from the database, and write it into an array so that it will be the same as a variable, i.e I get something like:
which can be used by the current fuctions.

Make any sense ???

#2 effigy

  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 06 July 2006 - 04:48 PM

MySQL has a a MAX() function to do this for you. If you still need to get the data into an array, see the tutorials on working with MySQL here.
Regexp | Unicode Article | Letter Database

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users