+ Reply to Thread
Results 1 to 3 of 3

Thread: Slight problem with mysql, php, and timestamps

  1. #1
    ember is offline x10Hosting Member ember is an unknown quantity at this point
    Join Date
    Apr 2010
    Posts
    2

    Solved: Slight problem with mysql, php, and timestamps

    Hello.

    While trying to add a logging feature to record the current and previous pages of a logged in user, I came across a problem. Every time the page loads while logged in, the query causes an error:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.10 8.42 pm' at line 1
    I have tried everything I could think of at this point, and was unable to find a problem with the timestamps when I googled it. Any help would be appreciated. The code that triggers this is below:
    PHP Code:
    $logquery "INSERT INTO user_log (username, page, ip) VALUES ('$username', purchase.php, " date('m.d.y g.i a') . "";
    mysql_query($logquery) or die(mysql_error()); 
    Thank you,
    Nicolai Guarino(ember).
    Last edited by ember; 04-23-2010 at 09:11 PM.

  2. #2
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Slight problem with mysql, php, and timestamps

    PHP Code:
    $the_date date('m.d.y g.i a') ;

    $logquery "INSERT INTO user_log (username, page, ip) 
                 VALUES ('
    $username', 'purchase.php' , '$the_date' ) " 
    You are missing some quotes...
    Nothing is always absolutely so.

  3. #3
    ember is offline x10Hosting Member ember is an unknown quantity at this point
    Join Date
    Apr 2010
    Posts
    2

    Re: Slight problem with mysql, php, and timestamps

    Seems I've gotten a bit rusty. That solved it. Thank you.

+ Reply to Thread

Similar Threads

  1. slight video problem
    By gothic_omen in forum Programming Help
    Replies: 1
    Last Post: 09-17-2008, 07:22 AM
  2. Slight Problem
    By rmb1993 in forum Free Hosting
    Replies: 2
    Last Post: 08-14-2008, 06:04 AM
  3. Slight Script Problem
    By Zenax in forum Scripts & 3rd Party Apps
    Replies: 11
    Last Post: 07-06-2007, 03:39 PM
  4. Very Slight Problem with my code
    By Zenax in forum Scripts & 3rd Party Apps
    Replies: 5
    Last Post: 08-29-2006, 07:17 AM
  5. Slight Problem
    By jo_j in forum Free Hosting
    Replies: 2
    Last Post: 05-08-2005, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers