Re: newbie array question

From: Date: Thu, 10 Jul 2003 14:51:21 +0000
Subject: Re: newbie array question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154738@lists.php.net to get a copy of this message
try this: $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 ); while($temp=sybase_fetch_array($result)){ $names[] = $temp[name]; } mfg. harry wiens ""Bob pilly"" <bobpilly@yahoo.co.uk> schrieb im Newsbeitrag news:20030710142939.70314.qmail@web40505.mail.yahoo.com... > Hi All > > Im new to php and are getting a bit confused about the sybase_fetch_array function (i think that this is the same as mysql_fetch_array?). > > 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); > > > I then try and do something like print $names[0]; > > but it doesnt work. Sorry if this is really basic any help would be greatly appreciated! > > > > --------------------------------- > Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

« previous php.general (#154738) next »