[PHP] SQL query to array?

2006-04-26 Thread William Stokes
Hello, Can someone please help me to put the results of a query to an array. Never done this before: $sql = SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri ASC; $result = mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; //create empty array that contains an array

Re: [PHP] SQL query to array?

2006-04-26 Thread Jim Lucas
William Stokes wrote: Hello, Can someone please help me to put the results of a query to an array. Never done this before: $sql = SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri ASC; $result = mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; //create empty

Re: [PHP] SQL query to array?

2006-04-26 Thread Richard Lynch
On Wed, April 26, 2006 1:39 am, William Stokes wrote: Can someone please help me to put the results of a query to an array. There are only a few thousand tutorials on this on the 'net... Never done this before: $sql = SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri ASC;

Re: [PHP] SQL query to array?

2006-04-26 Thread Joe Wollard
Will, Seems to me like you've just done it! Here's another way of doing it that will utilize mysql_fetch_assoc() to allow your query to dictate the elements of the array. Keep in mind, I haven't tested this, but since I'm not entirely sure what you are asking the list, I'll offer it anyway ;-)

Re: [PHP] SQL query to array?

2006-04-26 Thread William Stokes
Ooopps. I just did have array too many. This did the append corretly: $arr[Team$cur] = array(id = $id, sort = $srt, jnimi = $nimi); -Will Joe Wollard [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] Will, Seems to me like you've just done it! Here's another way of doing it that will