Thread: PHP Problems

  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Rep Power

    I need help in interfacing php with mysql.

    I want to format a date using mysql's date_format function.

    In telnet I typed the following and it works great:
    select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
    -> 'Saturday October 1997'
    But in php3 I typed the following and it does not work:

    $open_db = MYSQL_CONNECT("localhost","blablabla");
    $date_action = select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
    $date_name = MYSQL_QUERY($date_action,$open_db);
    echo $date_name;

    What is wrong with this code?
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Niagara Falls (On the wrong side of the gorge)
    Rep Power
    I'm not sure if it's a typo, but you don't have quotes around your assignment of $date_action:

    $date_action = "select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y')";

    Also, after mysql_query(), $date_name would contain the result index, not the result. You still need to extract the data from the results. I.E.:

    echo $date_name;


Similar Threads

  1. HELP! PHP - Mime email attachment problems
    By Jbafia in forum PHP Development
    Replies: 7
    Last Post: January 8th, 2005, 01:46 PM
  2. php sessions and security problems.
    By mochico in forum PHP Development
    Replies: 7
    Last Post: February 18th, 2004, 03:51 PM
  3. Email form in PHP was told having problems on a MAC?
    By solcjoye in forum HTML Programming
    Replies: 0
    Last Post: February 12th, 2004, 02:32 PM
  4. problems with php includes
    By boseph in forum PHP Development
    Replies: 9
    Last Post: January 23rd, 2004, 04:27 PM
  5. Problems updating mysql database using Php
    By bassist84 in forum PHP Development
    Replies: 2
    Last Post: January 18th, 2004, 04:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo