I can NOT make DATE_FORMAT work...any ideas?

Hello all,
In reviewing David Powers' fantastic book, 'PHP Solutions', I decided to do some work with dates in a database.
The table where the dates are stored is called cal_dates and is DATE type.
All the dates are stored as yyyy-mm-dd
When I write my query and add DATE_FORMAT, the page bombs no matter what I try.
As in:
SELECT *
DATE_FORMAT(cal_dates, '%c/%e/%Y') AS cal_dates
FROM cal_data
and I get a white screen.
So, I figured perhaps I should change the alias (the example in Pwers' book on page 390 does not use a different alias, but after struggling with this for almost 2 days, I am now trying anything):
SELECT *
DATE_FORMAT(cal_dates, '%c/%e/%Y') AS cdate
FROM cal_data
and I get another white screen.
Originally, my query was designed with a WHERE clause because I am selecting data from one table based on an a variable, but I read somewhere that DATE_FORMAT should not be used with WHERE...which is funny, since the two examples shown above with WHERE omitted still bomb.
The original query:
SELECT *
FROM cal_data
WHERE cal_data.page_ym = '$dateRef%'
works PERFECTLY. It pulls all information in the table relevant to the $dateRef variable.
The reason I wanted to use DATE_FORMAT is because I wanted to take the dates in my table from yyyy-mm-dd and display them in a different format.
But to no avail. Any thoughts or musings would be appreciated. I'm stonewalled.
Thank you all!
Sincerely,
wordman

iPHP,
I think I have too many queries posted here. I have tried many things in an effort to test what could be wrong, so let's start fresh.
This one works, sans DATE_FORMAT:
$sql = "SELECT page_ym, cal_dates, available, location, event
        FROM cal_data
        WHERE cal_data.page_ym = '$dateRef%'";
Again, I know this one has additional columns, but again, I've been trying many things since the original post and this is the format I'll be wanting to use.
Anyhow, as soon as I add DATE_FORMAT to the query, AND change the alias:
$sql = "SELECT page_ym, cal_dates, available, location, event
        DATE_FORMAT(cal_dates, '%c/%e/%Y') AS cdate
        FROM cal_data
        WHERE cal_data.page_ym = '$dateRef%'";
it bombs. I have used the column name as well as a different name for the alias, same thing.
I'm wondering if I whould use a seperate query just to pull the dates?
Thanks!
Cheers,
wordman

Similar Messages

  • TS3367 I'm having trouble making Facetime calls with my iphone 4s.  I can receive them; however, I can not make them.  Any ideas of how to fix this? PLEASE HELP!!!  Thank you!

    I am having a problem making phone calls using Facetime.  I was able to use it on two separate occassions; however, now I can not.  I can receive calls, but can not make them.  Not sure what to do.  Any ideas?  Any help would be greatly appreciated.
    Thank you VERY much!

    There are a lot of posts in the forums today with people having problems with iMessage.   There was also a published outage yesterday, so it's possible there are still some issues that may be impacting you both.
    I would just wait it out - I'm sure it will be sorted out soon.

  • I can not make AirDrop work, any help?

    I tried to use AirDrop among my Imac and my MacBook pro, they do n ot let me select the files, so I can not trasnsfer them
    Any help?

    Amazing lack of informaition, I'd recommend starting by carefully reading:
    http://support.apple.com/kb/HT4783?viewlocale=en_US&locale=en_US
    http://support.apple.com/kb/PH11376

  • Need to add condition to a template and can not make it work.

    I am trying to add a condition to a template and can not make it work. Mainly because I am new at this. I have a field that needs to have a condition set. The field is LTD. The maximum value is $233.00. If the amount is less the 233, that value is used. If it is over 233 then 233 is used. So, if LTD is greater then 233.00 then 233.00 else LTD.
    Can anyone help me write this for a Word BI Publisher Template. I need this report now but can't go to class until later this year.
    Thanks,
    Rick

    Replace LTD with the correct element name.
    <?choose:?>
    <?when: LTD > 233 ?>233<?end when?>
    <?otherwise:?><?LTD?><?end otherwise?>
    <?end choose?>

  • I bought and downloaded a movie to my macair and it showed in my library yesterday. Today however i can not find it. Any idea why that would be? I did buy it and not rent FYI

    I bought and downloaded a movie to my macair and it showed in my library yesterday. Today however i can not find it. Any idea why that would be? I did buy it and not rent FYI

    OK, I think I understand what's happening.
    Movies are now stored in iCloud: see http://www.apple.com/itunes/inside-itunes/2012/03/movies-now-available-on-icloud .html
    So they may take a while to download to your Mac.  Movies are big, after all.
    I believe you can guarantee the movie stays on your Mac by going to Preferences (in the iTunes menu at the top), and going to the "Advanced" tab, and checking "Copy files to iTunes media folder when adding to library".
    Hope that helps!

  • Can not make Groups work in Address Book

    I'm running Mac OS X v10.7.4 with the latest version of Address Book. I'm new to Apple and am trying to set up groups in Address Book for ease of mailing to a number of contacts.
    I'm connected to iCloud and am able to create  group names under iCloud. I can also drag contacts into a group from my iCloud contact list to populate it and the names are displayed on the opposing page from the page listing the group names. However, when I enter the group name into a Mail message address box the box remains blank. Also, if I right click on the group name in the group list and select "Send an e-mail to the group" that will open a "new message" window but again the "to box" will be empty. When I click on a group name and then select from the task bar "Edit>Edit Distribution List..." that choice is grayed out and non-responsive. So I end up with a defined group with group members in it but it can not be edited nor available for actually addressing an e-mail message.
    However, this is the weird part: What I described above was my effort yesterday, trying to get Groups going and finally shutting down in frustration. Today when I opened Address Book the groups worked! I could address e-mail messages using either method. The "Edit Distribution List..." was active and I was able to modify my group members. I was so elated that I immediately created another group. Alas, it behaved as the other groups did yesterday. The group was populated but unable to be inserted in the "to box" and I was unable to edit the distribution list. Also, after creating the new group, yesterday's groups would no longer permit being edited although I was able to earlier in the day. However, the addresses still appear in the "to box" when I invoke the group.
    I am confused and frustrated. Do I have an incorrect setting that hinders the use of groups? Is there some system reset or iCloud update that occurs on a daily basis that activated the groups created yesterday? Why would my creating a new group cause me to loose the ability to edit any of the groups?
    Any help will be greatly appreciated.
    Thanks for reading such a long message.
    Mike

    Eureka. You are right. I just tested closing and reopening Mail and now today's groups work. Regarding editing the existing groups, I found an article from 2011 on CNet that claimed that iCloud disables the Distribution List Editor. The work around is to create a single dummy group under "On My Mac" which will reactivate the editor which can then be used for iCloud groups. I tested this and it works.
    Thank you so much for your prompt and helpful comment.
    Mike

  • Camera can not be detected! any ideas?

    i am programming a microsoft which just likes NetMeeting,and i have a problem now.this question might seem silly to you ,but i am a new jmf_er,so i need your help!
    to detect camera ,i wrote the code as follows:
    Vector list = CaptureDeviceManager.getDeviceList ( null );
    if ( list != null )
    for ( int i=0; i<list.size(); i++ )
    devInfo = (CaptureDeviceInfo)list.elementAt ( i );
    name = devInfo.getName();
    System.out.println(name);
    if ( name.startsWith ("vfw:") )
    System.out.println ("DeviceManager List : " + name );
    capDevices.addElement ( new MyCaptureDeviceInfo ( devInfo ) );
    but i discovered that there is no name starts with ("vfw:")!and the camera can be detected when i use another microsoft !
    i do not know what is wrong ,
    any ideas are welcome,thank you!
    Regards
    Adigan

    The ist thing is that ur code is incorrect
    the last statment (addElement)is not meant to be here
    use the following code..
    CaptureDeviceInfo devInfo=null;
    Vector list = CaptureDeviceManager.getDeviceList ( null );
      if ( list != null ){
            for ( int i=0; i<list.size(); i++ ){
                              devInfo = (CaptureDeviceInfo)list.elementAt ( i );
                          String name = devInfo.getName();
                          if(name.startsWith ("vfw:")){
                               dExist=true;          
                                                                             break;
         if(dExist==true){
                   MediaLocator m = devInfo.getLocator();
                    DataSource ds = null;
         try {
              ds=Manager.createDataSource(m);                                Player player = Manager.createRealizedPlayer (ds);
                       player.start();              
                        Component videoScreen= player.getVisualComponent();
              Frame frm=new Frame();
              frm.setBound(100,100,300,300);
              frm.add(videoScreen);
                                              frm.setVisible(true);
         } catch (Exception e) {
    else{System.out.println("no device exist");}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • I can not make fMMS work on my N900 in Brazil - CL...

    Hello! I am using my N900 for 1 month so far... However I can not use fMMS in my N900. I already have the latest version, but nothing so far...
    I have looked at many types of configurations as well and noting...
    I am in Brazil, Sao Paulo and I use Claro operator.
    Does anyone know how to configure? Could you please help me?
    Thank you!
    Paulo Rocha -

    i could not find Claro here, but i am sure that if you check out the information and ask on the maemo.org site, someone will help you with that.
    here is the wiki page
    http://wiki.maemo.org/MMS
    if you can get someone to get it working for you, have them update the wiki to help everyone else.

  • Replaced hard drive - now can not install an OS - any ideas?

    That's right. The iMac was given to me and the "giver" did not give me any CDs etc. (very old iMac).
    Anyway, the hard drive was bad, so I replaced it along with 512 of RAM.
    I am unable to install any OS because all my OS X versions are upgrades. I just want to see if the thing will work worth anything with OS X before I keep it.
    I bet I'm stuck aren't I?
    D.

    If UR looking for original Cd's - check out your local "quokka' mag - you know, the one that has all the for sale items - furniture, whitegoods, computers etc - here in Perth Australia we have teh 'Quokka'. Anyway,try all the 'imacs for sale' contacts until you find either someone who has original CD's for sale - this could be someone who gets bulk intakes of 2nd hand computers - PC and/or Mac - often they get shipmetns of @nd hand computers form schools and the original software Cd's as well- you could pick up a bargain?!
    What colour is your iMac?? Apple has a chart to distinguish it's computer series on its info base - I think (hang on and I'll go find it for U) ...... ah, here it is - http://docs.info.apple.com/article.html?artnum=58669 - will help a little bit in differentiating between models.
    Look, Mr Singitloud-in-the-shower, these G3 iMacs are great little beasts - I just love them - even at 55 - and today I've pulled my first one apart - but it's a scrap piece with the CDRW and HD already scavenged - but it's my learn-on machine - now I just need to find where on the web you can find reliable fix-it info so I can learn more repair ideas.
    se ya
    Gregg

  • Can not make printer work with AEBS

    The printer is hooked to AEBS via USB and it is being rocognized by the printer utility, but when selecting to connect with Bonjour I get Error # 9672.
    Please help.
    Macbook pro   Mac OS X (10.4.9)  

    Unfortunately, not all USB printers are compatible with AirPort base stations. Take a quick look at the iFelix Unofficial AirPort Printer Compatibility List to see if your printer is listed. If it isn't, it doesn't necessarily mean it won't work, but simply that it has not been verified. iFelix also provides the following workaround for printers not on the list that would certainly be worth a try.
    Also, you may find the following Apple article helpful.

  • Since I downloaded Firfox 4.0 I am having trouble sending e-mails. Norton sends the e-mails back stating the e-mail can not be sent. Any ideas why this is happening?

    Why is Norton returning half of my e-mails that I forward? This started happening after I downloaded Firefox 4.0 on 3-25-2011.

    Thunderbird saves your drafts every five minutes by default. Sometimes auto-saved draft messages aren't cleaned up, giving you the impression that the incomplete messages are also sent. This happens especially for drafts stored on an IMAP server. You can change the configuration to save the draft messages locally by going to Tools -> Account Settings -> [account] -> Copies & Folders- > Drafts and Templates -> Keep message drafts in... and choose Drafts folder on Local folders...

  • I can't get home sharing to turn on on my computers. I have a PC running windows XP that has a large library on it that I want to access from a newer windows 7 PC. I have turned home sharing on in both, same apple ID. I just will not come up. Any ideas?

    I can't get home sharing to turn on on my computers. I have a PC running windows XP that has a large library on it that I want to access from a newer windows 7 PC. I have turned home sharing on in both, same apple ID. I just will not come up. Any ideas?

    Ugh, disregard.. it magically started working -_-

  • My iPhone 3gs is not recognized by my PC or iTunes and i can't open it. Any idea what's the problem?

    My iPhone 3gs is not recognized by my PC or iTunes and i can't open it. Any idea what's the problem?

    I had the same problem with my phone, its a 3gs, out of no where my laptop stop recognizing it and wouldnt charge either, i got worried because i had all my pix and videos on my phone and didn't have a copy, so i started searching on the internet for an answer to my issue, bought extra usb cables, used different laptops and nothing worked .. Untill i took my cell phone apart and thought about replacing the (charge port assembly for apple Iphone 3gs) so ordered the part online and 3 days later got it and i just replaced it right now... and guess what/??? IT WORKED!!! YEAP.. NOW MY CELL IS CHARGING AND I JUST SYNC MY STUFF.. I HOPE THIS CAN SOLVE YOUR PROBLEM... AND ONLY COST ME 8 DLLS

  • HELP!  I had iPhoto on my mac, for some reason it was not responding down loaded a new version but can't find my photos. any ideas please.  I thought once on the mac always on the mac.

    HELP!  I had iPhoto on my mac, for some reason it was not responding or damaged.   down loaded a new version but can't find my photos. any ideas please.  I thought once on the mac always on the mac.

    Sorry but we need details to help
    What version of the OS do you have? What has changed since iPhtoo worked?
    What exactly is the problem - you say "it was not responding" - You downloaded a new version (what version)" -you can't find yoru photos" none of which is helpful
    look in your applications folder - is there an Iphoto application there? If so get info and report the version
    Look in the picures folder - is there an iPhoto library there? If so exactly (including exact error messages) happens if you double click on it?
    what else can you tell us that might help us assist you?
    LN

  • My digital editions saying not working but I uninstalled and reinstalled and it is still not working, any ideas?

    My digital editions saying not working but I uninstalled and reinstalled and it is still not working, any ideas?

    Hi imtheozzman, check if your security software is the problem, see : [https://support.mozilla.org/en-US/kb/configure-firewalls-so-firefox-can-access-internet Configure firewalls so that Firefox can access the Internet ]
    thank you

Maybe you are looking for

  • Will ipod touch settings copy to a new iphone with cloud / same apple id?

    My daughter has an ipod touch 4th generation. I had set the restrictions on her touch, but have since forgotten the password. We are giving her an iphone 5c for the holidays and I'm wondering if she uses the same itunes/apple account for her phone as

  • How do you get songs not in your library?

    I have some songs that are not in my library so I can't download them into my iPod. HELP PLEASE!!!!!!!!!!!

  • Having trouble getting my ipod to be recognized by my computer

    I can't seem to get my ipod touch to be recognized by my computer. I already have itunes installed because my brother also has an ipod touch. Whenever i connect mine though it recognizes my ipod as a camera. any help?

  • Hi All, ready for a quick mask question from a newbie ;-) ?

    When I make a quick mask selection, it becomas "red-ish" as it suppose to. When I leave quick mask mode however, the painted area does not become a visible (yes I checked the correct option dialogue box, I guess, according to a friend) selected area

  • Help in Editing notes on the score

    This notes thing is cool but editing seems difficult. I must be missing some short cuts. I can play thru the midi and the notes show up. I'd like to tweak them and shift them because what shows as the fourth beat in one measure should be the first be