I have been working on a little bit of code to mimic the look of my vbulletin site, which most of the users are used to, so when I finally open the store it has a look and feel they are used too.
Anyways, I have a login box that is in the breadcrumbs, and after login, it works similar to the vbulletin breadcrumb login. Has the Welcome, FirstName. Under that is where I want to add the time of the last visit. Now I accomplished that with a bit of coding ... and I have that working ... however I can't seem to figure out a way to format the output from the SQL table.
Here is my current code.
modules/pages/login/head_php.php
Code to query the last login info.
Code:
$last_login_query = "SELECT customers_info_date_of_last_logon
FROM " . TABLE_CUSTOMERS_INFO . "
WHERE customers_info_id = :customersID";
$last_login_query = $db->bindVars($last_login_query, ':customersID', $check_customer->fields['customers_id'], 'integer');
$last_login = $db->Execute($last_login_query);
Code to allow east output into the templates.
Code:
$_SESSION['customer_last_logon'] = $last_login->fields['customers_info_date_of_last_logon'];
Now in this same file I noticed the SET of the last_login with the now() function. Which looks like this ...
Code:
$sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
SET customers_info_date_of_last_logon = now(),
customers_info_number_of_logons = customers_info_number_of_logons+1
WHERE customers_info_id = :customersID";
$sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
$db->Execute($sql);
I am in the process of learning SQL, but understand the basics ... I have tried to apply the date_format on that SET customers_info_date_of_last_logon, but it just outputs with all 0's. This is where I would really like to make the changes. I just can't figure it out. Just trying to move along. I also understand it is server based time ... but this can be fixed later. Right now I just need to get a way to format the time, that gets stored to the database.
You can see the function of the login etc at www.mafia-motorsports.com/store
Sorry for the long post, but I am hoping someone here can clue me in. Thanks!
Bookmarks