Unrelated to your error, but I do believe your code is flawed on many levels, and wont be doing what you think it's doing. Let me show you:
$videos = mysql_fetch_assoc($videos);
foreach($videos as $video){
echo '<div class="video">';
echo '<a href="video.php?v="'.$video['video_id'].'"> <h3>"'.$video['title'].'"</h3></a>';
echo '</div>';
}
You may think that code is going to run for each video that is returned by the query, but it's not. You're actually foreach'ing over a single video, and that's it. The value of $video inside the foreach loop won't be an array. It will be the individual values within a single video array.
But there's more:
if($videos){
The value of mysql_query is either false, which means there was an error, or a resource pointing towards zero or more rows. It does not tell you if there were rows returned or not.
This is how your code should be written:
$query = "SELECT video_id,title FROM video_id";
$videos = mysql_query($query);
/**
* There was an error if $videos is false. Use mysql_error()
* to get a message explaining the error.
*/
if (!$videos) {
die(mysql_error());
}
/**
* You use the function mysql_num_rows() to find out how many
* rows were returned by the query.
*/
if(mysql_num_rows($videos) > 0) {
/**
* You need to keep calling mysql_fetch_assoc() until there are
* no more rows to return.
*/
while($video = mysql_fetch_assoc($videos)) {
echo '<div class="video">';
echo '<a href="video.php?v="'.$video['video_id'].'"> <h3>"'.$video['title'].'"</h3></a>';
echo '</div>';
}
} else {
echo "<p>No new videos actually</p>";
}
mysql_close();