i dont quite think i understand the question, but if you
want to fetch results as an array with mysql, do this:
$result = mysql_query(" sql ");
mysql_fetch_array($result);
> -Original Message-
> From: Chris Oxenreider [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 09, 2001 12:39 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP array information.
>
>
>
> Hello:
>
> My apologies if this has been covered before, or if i have missed it on
> the php manual web pages. I am looking for some information on how to do
> a perl like array with a *sql call in PHP.
>
>
> Here is what I want to do:
>
> table:
> problem_class
> _rid (tinyint)
> description (mediumtext)
>
> Sample data:
> _riddescription
> 1 open
> 2 closed
> 3 testing
> 10 S
> 11 M
> 12 L
> 13 XL
> 20 Black
> 21 Red
> 22 Green
> 23 Blue
>
>
> In perl this might be accomplished by doing this:
>(Note some pseudo code is used here. Assume mysql as database but
> could be others like Oracle.)
>
>$query = "SELECT _rid,description FROM problem_class";
>$q_pointer = sql_query($query);
>@problem_class = sql_associate_array_get($q_pointer);
>
>print "\n";
>for ($i = 0; $i < 10 ; ++$i) {
>if ( $problem_class[$i] ne "") {
>print " $problem_class[$i]\n";
>}
>}
>print "\n";
>
>print "\n";
>for ($i = 10; $i < 20 ; ++$i) {
>if ( $problem_class[$i] ne "") {
>print " $problem_class[$i]\n";
>}
>}
>print "\n";
>
>print "\n";
>for ($i = 20; $i < 30 ; ++$i) {
>if ( $problem_class[$i] ne "") {
>print " $problem_class[$i]\n";
>}
>}
>print "\n";
>
>
> This produces something very close to this:
>
>
> open
> closed
> testing
>
>
>
> S
> M
> L
> XL
>
>
>
> Black
> Red
> Green
> Blue
>
>
>
> If I could use something like this, it would allow me to produce different
> 'for' statements for each select drop down I wanted to create. One table
> to maintain, and change encase politics force me to change some of
> definitions with out having to do a massive sql update. This works as
> long as the problem_class table is rather short (ie less than 1,000
> records).
>
> I know I am missing something 'obvious' in this. Your help is
> appreciated. Thank you.
>
>
>
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Chris Oxenreider | [EMAIL PROTECTED] | http://www.state.net/~oxenreid
> | MicroSoft Windows 2000: The De facto sub standard.
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]