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

 <?php 
    $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:

$session->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

$datetime 

line.

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.

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.

commented: Thank You +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.