11-20-2016, 02:40 AM
It's ugly, but it's working haha
//set check-in function
function checkIn()
{
$timein = date('H:i');
echo 'Your check-in time is '.$timein.'.';
$chkfields=array(
'id' => $logged_in->id,
// 'username' => $logged_in->username, <-- Can't get this working for some reason though
'timein' => $timein,
);
$db = DB::getInstance();
$db->insert('clicks', $chkfields);
}
root@training [/home/randomserverpathhere/]# mysql somedbhere -e 'select * from clicks;'
+----+----------+--------+
| id | username | timein |
+----+----------+--------+
| 4 | | 21:35 |
+----+----------+--------+
root@training [/home/somepathhere]# mysql somedbhere -e 'describe clicks;;'
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| username | varchar(255) | NO | | NULL | |
| timein | varchar(255) | NO | | NULL | |
+----------+--------------+------+-----+---------+----------------+
Unfortunately I can't figure out the datetime/timestamp issue between PHP and the DB just yet...but I have made real progress now lol. Just had to dig around the user class docs a bit and watch the db class videos to understand why it wasn't working.
//set check-in function
function checkIn()
{
$timein = date('H:i');
echo 'Your check-in time is '.$timein.'.';
$chkfields=array(
'id' => $logged_in->id,
// 'username' => $logged_in->username, <-- Can't get this working for some reason though
'timein' => $timein,
);
$db = DB::getInstance();
$db->insert('clicks', $chkfields);
}
root@training [/home/randomserverpathhere/]# mysql somedbhere -e 'select * from clicks;'
+----+----------+--------+
| id | username | timein |
+----+----------+--------+
| 4 | | 21:35 |
+----+----------+--------+
root@training [/home/somepathhere]# mysql somedbhere -e 'describe clicks;;'
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| username | varchar(255) | NO | | NULL | |
| timein | varchar(255) | NO | | NULL | |
+----------+--------------+------+-----+---------+----------------+
Unfortunately I can't figure out the datetime/timestamp issue between PHP and the DB just yet...but I have made real progress now lol. Just had to dig around the user class docs a bit and watch the db class videos to understand why it wasn't working.