On Tuesday 11 November 2003 23:07, bob pillford wrote: > Hi all i have the following code which isnt working correctly and i cant > work out why. Any help would be greatly appreciated as its sending me > crazy! > > $query = "select refno from campaign where appdate between 'nov 07 2003' > and 'nov 08 2003' "; $result=mssql_query($query,$numero); > $numrows=mssql_num_rows($result); > $row=mssql_fetch_row($result); > echo $numrows; > print_r($row); > > > Now this returns: 23 > Array ( [0] => 1044998 ) > > which is 23 for number of rows the query returns but it only ever stores > the 1st element of the returned array in $row.. Can someone tell me where i > am going wrong as i need access to the other 22 rows that this query > returns.... I have echoed the query and run the out put under freetds tsql > and get the correct result (this is what i use to access the ms sql server > 2000).
mssql_fetch_row() only gets *one* row. To get the rest use something like a while-loop. For examples refer to the similar mysql_* functions. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* You will pay for your sins. If you have already paid, please disregard this message. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php