I've got this currently on my homepage:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
<td align="center">
<p><?php if ( $now_playing["count_played"] > 0 ) { ?>
<?php echo( date( $configuration->date_time_format, strtotime( $last_played["date_played"] ) ) ); ?>
<?php } ?>
<?php if ( $now_playing["count_played"] = 0 ) { ?>
<?php echo "Never"; ?>
<?php } ?>
</td>
But I'm not sure from the query entered above where to (or what file) I put in the SQL to query the database and how to format it. I can see Never if the value is 0, but can't see a date because it doesn't have the SQL to drive the query. I think this will remain blank until the PHP knows where to find the data. When I put it in my code my page has a problem and won't load.
Would this be close to what I'm looking for? It breaks my PHP code every time no matter what .php file I put it into, but leaning toward class.song.php:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
public static function lastPlayed() {
$db = Database::getInstance();
$select = $db->select()
->from(array('h' => 'historylist'),
array('*'))
->where('s.songtype = ?', 'S')
->order('h.date_played DESC')
->limit('HISTORY_COUNT+1')
}
return $last_played;
}
Lord help me, I'm just not that proficient with PHP and mysqli queries.