Re: Result problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Shirah wrote:
Okay, print_r($result_record) for the query result.

But I still don't know why it's only returning the last record of the query
instead of all the results.

Because it's a cursor and you're not resetting the position. You can't print the entire result set this way - you have to iterate through the result set in a loop, printing out the row on each iteration.

Lori

On 4/25/07, Zoltán Németh <znemeth@xxxxxxxxxxxxxx> wrote:

2007. 04. 25, szerda keltezéssel 16.56-kor Dan Shirah ezt írta:
> Any ideas why my query only returns the very last record that matches
the
> criteria specified??
>
> $sql_record ="SELECT * FROM payment_request WHERE status_code = 'P'";
> $result_record = mssql_query($sql_record) or die(mssql_error());
>   if(!empty($result_record)) {
>   while ($row_record = mssql_fetch_array($result_record)) {
>      $id_record = $row_record['id'];
>    }
>   }
>   print_r ($sql_record);

in the above line you are printing out the query. I think that's not
what you want...

greets
Zoltán Németh

>
> The result of the print_r displays only the last record that matches the
> query criteria.  I tried a foreach instead of a while with no luck.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux