someone here with php mysql experience please take a look a the following and tell me if the sql statement makes sence... I'm very new to php and I'm trying to teach myself by editing and writing little scripts.
this is the query
$sql = 'SELECT artist_id, ' . ARTIST_TABLE . '.artist_name, artist_prefix, artist_url, ' . GENRES_TABLE .'.genre_id, genre_name ' .
' FROM ' . SONGS_TABLE . ', ' . ARTISTS_TABLE . ', ' . GENRES_TABLE .
' WHERE (' . SONGS_TABLE . '.artist_id = ' . ARTISTS_TABLE . '.artist_id ) AND
(' . SONGS_TABLE . '.genre_id = ' . GENRES_TABLE . '.genre_id ) ';
$sql = append_status_sql($sql);
$sql .= ' ORDER BY artist_id DESC LIMIT 10';
$result = $db->sql_query($sql);
while ($sql_data = $db->sql_fetchrow($result))
{
$template->assign_block_vars('new_artists', Array (
'U_VIEWARTIST' => append_sid('view_artist.php?id=' . $sql_data['artist_id']),
'ARTIST_NAME' => artist_add_prefix($sql_data['artist_name'], $sql_data['artist_prefix']),
'T_FFGENRE' => $sql_data['genre_name'])
);
}
this is how it is referenced in the template
<tr>
<td class="catSides"><span class="cattitle">Newest Artists</span></td>
</tr>
<tr>
<td class="row1"><span class="genmed">
<!-- BEGIN new_artists -->
* <a class="genmed" href="{new_artists.U_VIEWARTIST}">{new_artists.ARTIST_NAME}</a>
- <span class="gensmall">{new_artists.T_FFGENRE}<br/>
<!-- END new_artists -->
</span></td>
</tr>
I am wondering if the sql query is the problem?? All the tables referenced are valid. please help. thanks in advance