Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

expects parameter 1 to be resource, boolean given

$
0
0

I have been doing this all by myself. I have tried to only look for help when I can't find a possible fix, but I am getting very frustrated now. I have spent like an hour trying to figure out why this keeps happening. Please help me if anyone has time to look at this.

 

I am getting this error:

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\video.php on line 7

 

 

 

in regards to this code:

include 'dbconnect.php';
$youtubeid = ($_GET['id']); 

//Youtube video ID.
$query = mysql_query("SELECT * FROM video WHERE youtubeid='$youtubeid' ");

$numrows = mysql_num_rows($query);


	if ($numrows != 0){
		while ($row = mysql_fetch_assoc($query))
		{
			$dbyoutubeid = $row['youtubeid'];
		}
//Check to see if video exists within our database.
if ($youtubeid==$dbyoutubeid){
		//Youtube Embed 
		echo '<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$youtubeid.'" frameborder="0" allowfullscreen></iframe>';
			}else{
					echo 'Sorry that video does not exist in our library!';
			}
	}

Viewing all articles
Browse latest Browse all 13200

Trending Articles