Hi, I tried to convert timestamp into the actual date and time.

    $connectmysql = mysql_connect("localhost", "********_login", "********");

     mysql_select_db("********_login", $connectmysql);

      $timestamp = mysql_query("SELECT timestamp FROM blog_users 
       WHERE username = '<?php session->username ?>', $connectmysql);

      $datetime = date("Y-m-d H:i:s", $timestamp);


This gets the user's username:


But, then I get an error:

Parse error: syntax error, unexpected 'Y' (T_STRING) in /home/promanx2/public_html/admin/admin/index.php on line 12

That's the



Please could someone help. I'm also a beginner at php, so please could you make your answers simpler and explain what it does, if you want.

Edited by BadManSam: Forgot something

5 Years
Discussion Span
Last Post by chrishea

If you look carefully you will see that you have an opening double quote before the Select on line 6 but there is no closing double quote on line 7.

Errors in PHP often point to the first symptom of an error rather than the specfic cause. You have to work backwards on the preceding line(s) to look for missing quotes, brackets, braces or semi-colons. PHP is looking for a match for an opening (,{,[,",' and only recognizes that it has an error when it finds some sort of illogical situation. In this case, it finds another double quote on line 9 followed immediately by the 'Y' but recognizes that this can't be the closing double-quote for the preceding line so that's when it reports an error. There are probably good reasons why the error message isn't more direct but the result is a fairly obtuse indication of an error. This sometimes makes the finding of the actual error a bit challenging, especially if the code isn't clean and simple.

Votes + Comments
Thank You
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.