Re: Pulling my hair out [message #172407 is a reply to message #172405] |
Wed, 16 February 2011 18:36 |
sheldonlg
Messages: 166 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 2/16/2011 1:01 PM, Michael Fesser wrote:
> .oO(sheldonlg)
>
>> I have this TRIVIAL code and I am pulling my hair out because of it:
>>
>> <?php
>> function getAllEvents() {
>> $sql = "SELECT * FROM events
>> WHERE eventDate> NOW()
>> ORDER BY eventDate LIMIT 4";
>> print $sql;
>> $result = mysql_query($sql);
>> var_dump($result)
>> $list = array();
>> while ($row = mysql_fetch_assoc($result)) {
>> $list[] = $row;
>> }
>> return $list;
>> }
>>
>> with the two diagnostic included as above. I use the sequel statement
>> in phpmyadmin and it yields four entries and they are correct. However,
>> the var_dump results in boolean(false) and no results are extracted (of
>> course).
>
> What does mysql_error() say?
>
> Micha
This turns out to be a "forget it and thanks". I was helping my
daughter with this one and the very first thing I asked her when they
came up with different results was "Are you going against the same
database and table?". She said yes, there was only one.
In working with it more today, she removed some zero date entries from
the table and used a workaround that I gave her. They still appeared,
so I asked her once again "Are you going against the same database and
table?". Then she remembered that she had set up a testing server and,
in fact, they were not the same database. Problem solved.
Thanks Micha.
--
Shelly
|
|
|