Re: newbie array question
| From: | David Nicholson | Date: | Thu, 10 Jul 2003 14:36:00 +0000 |
| Subject: | Re: newbie array question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154737@lists.php.net to get a copy of this message | ||
Hello,
This is a reply to an e-mail that you wrote on Thu, 10 Jul 2003 at 15:30,
lines prefixed by '>' were originally written by you.
> If i have a valid sql query that returns three the records
> 'john','jack' and 'mary' and i want to put that into an array
> where
> array[0]->john,array[1]->jack etc how do i do this? Im trying to use
> sybase_fetch_array as follows:
> $query = "select name from names (where age <'23'')";
> $numero= sybase_connect("database" , "user" , "password" )
> or die ("Unable to connect to database server");
> $result=sybase_query($query,$numero );
> $names=sybase_fetch_array($result);
sybase_fetch_array will fetch one row of the result, if you want all
three rows in one array you will need something like this...
$allnames = array();
while($thisname = sybase_fetch_row($result)){
$allnames[] = $thisname[0];
}
I have never used the sybase db functions though so I may be incorrect.
All the best,
David.
--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Professional Web Development by David Nicholson
http://www.djnicholson.com/
QuizSender.com - How well do your friends actually know you?
http://www.quizsender.com/
(developed entirely in PHP)