How can I convert following query to a working function? Tried a lot, but as a newbie it's way to difficult ..
Query:
SELECT categorylist.*, songlist.id, songlist.info, songlist.title, songlist.album, songlist.picture, songlist.artist, songlist.date_added FROM categorylist, songlist WHERE categoryid > 0 AND categoryid < 17 AND categorylist.songid=songlist.id AND songlist.songtype='S' ORDER BY songlist.date_added DESC LIMIT 50
Function (this is a example which I want to use for this)
$select = $db->select()
->from(array('s' => 'songlist'),
array('*'))
->join(array('h' => 'historylist'),
'h.songID = s.ID',
array('listeners', 'requestID', 'starttime' => 'date_played'))
->joinLeft(array('r' => 'requestlist'),
'r.id = h.requestID',
array('dedicationName' => 'name',
'dedicationMessage' => 'msg'))
->where('s.songtype = ?', 'S') //Only return song of type S
->order('h.date_played DESC')
->limit(HISTORY_COUNT + 1);