FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Pulling my hair out
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Pulling my hair out [message #172407 is a reply to message #172405] Wed, 16 February 2011 18:36 Go to previous messageGo to previous message
sheldonlg is currently offline  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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Welcome to PhoToZfAiR
Next Topic: PHP Malaysia Meetup 2011 : Framework Shootout
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 16:41:28 GMT 2024

Total time taken to generate the page: 0.05737 seconds