Adding some php/mysql database queries to a site, and not sure how to structure this one.
The table looks like:
memberid 1111 1112 1119 1349 1350...
1 1 1 0 0 0
2 0 1 1 0 0
3 1 1 0 0 1
...
The column names (1111 etc.) are video id’s, and the the zero’s and ones represent whether that member has that video in their queue or not.
My query needs to look at one member, and see which videos are in their queue.
I’m intending for my code to look somewhat like:
$data = mysql_query("SELECT column names FROM queue WHERE memberid = $memberid AND its value = 1", $connection);
if (!$data) {
die("Database query failed: " . mysql_error());
}
while ($result = mysql_fetch_array($data)) {
$list[] = $result['columnnames'];
}
Help! Thanks.
-Daniel
Why would you have a column for every video?
Member:
Video:
MemberQueue:
Get a members videos in their queue: