I didn’t write this web script code, but I’m trying to modify it.
I am attempting to have this:
$get_videos = $db->rawQuery("SELECT DISTINCT(v.id), v.* FROM u_paid_videos AS upv LEFT JOIN " . T_VIDEOS . " AS v ON (upv.id_video = v.id) WHERE upv.id_user = {$user->id} AND upv.session_key = '{$_SESSION['session_key']}' ORDER BY upv.id DESC");
have it work from another table: ‘videos_transactions’ (instead of u_paid_videos).
I’m sure overall it can be improved, but first I’d like to get this working.
I’ve tried this modified line without success:
$get_videos = $db->rawQuery("SELECT DISTINCT(v.id), v.* FROM videos_transactions AS vt LEFT JOIN " . T_VIDEOS . " AS v ON (vt.video_id = v.id) WHERE vt.user_id = {$user->id} AND vt.session_key = '{$_SESSION['session_key']}' ORDER BY vt.id DESC");
Being there is a ‘videos’ table in the db, and this is about get_videos, would I be correct to assume that v.* is ‘videos’ table? I think T_VIDEOS might mean ‘videos’ table. And I can tell you that ‘videos_transations’ table has video_id field, user_id field and session_key field in it, with the same structure as the same fields in ‘u_paid_videos’.
Can you suggest possibly why the modified line isn’t working?
I look forward to any guidance.