phatgreenbuds Posted November 9, 2008 Share Posted November 9, 2008 So I have this little bit of logic going where the code below will check one table for an entry. If it finds it then the $path is set and writes to a file. If its not then it should perform a query against another table for a default (random) entry to write to that same file. SO far this will work but only if I leave out the second query. With it in it keeps giving the following error: "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/esv/aMT_dallas_playlist.php on line x" <?php //Starts the Query for content to write to the playlist $query = "SELECT * FROM $MTtblname WHERE content_region = 1"; $content = mysql_query($query); $num = mysql_num_rows($content); // //Opens the playlist file to start writing assuming there is at least one entry if ($num != 0) { $file = fopen("../test/Videos/MTdallas_playlist.wsx", "w"); $wsxpl = "<?wsx version=\"1.0\"?>\r\n"; $wsxpl .= "<smil repeatCount=\"indefinite\">\r\n"; while ($row = mysql_fetch_assoc($content)) $exists[$row['tbl_slot']] = $row['content_win_path']; for ($count = 1; $count <= 60; $count++) { if (key_exists($count,$exists)) { //if there is an entry in that time slot then use it and place it in the file $path = $exists[$count]; }else{ // otherwise go to the default table and pull a random entry into the playlist $queryx = "SELECT * FROM $tbl_def_content ORDER BY RAND()"; $contentx = mysql_query($queryx); while ($rowx = mysql_fetch_array($contentx)) { $path = $rowx['content_win_path']; } } echo $count . ': ' . $path . '<br>'; $wsxpl .= "\t<media src=\"" . $path . "\"/>\r\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/131989-solved-logic-errors/ Share on other sites More sharing options...
phatgreenbuds Posted November 9, 2008 Author Share Posted November 9, 2008 Nevermind...I am a total retard. Link to comment https://forums.phpfreaks.com/topic/131989-solved-logic-errors/#findComment-685845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.