Re: Trouble running a select query against a database, when I know the connection is working, and the data is there
| From: | Richard Quadling | Date: | Tue, 13 Apr 2010 10:02:01 +0000 |
| Subject: | Re: Trouble running a select query against a database, when I know the connection is working, and the data is there | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-30023@lists.php.net to get a copy of this message | ||
On 13 April 2010 11:00, Toby Hart Dyke <toby@hartdyke.com> wrote:
> On 4/13/2010 9:36 AM, Jacob Kruger wrote:
>>
>> $qry = mysql_query($sql);
>> $arr = mysql_fetch_array($qry);
>> if ($arr.count > 0)
>> {
>> echo "<ul>";
>> while($row = mysql_fetch_array($arr))
>
> You retrieve a row, check if it has any elements, then attempt to retrieve
> the next row, using the array you just created as the argument. You should
> be using $qry as the argument, but you're skipping over the first row.
>
> Toby
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Good catch Toby.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling