Jump to content

Recommended Posts

Hi,

 

I am making a video page on my site:

 

http://ilkleysb.com/v3/videoplayer.php?videoid=6

 

This works fine, but I want to have a comments system on here to.

 

I added the form like normal but when submit is pressed I get the mysql_fetch_array error shown below:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ilkleysb/public_html/v3/videoplayer.php on line 32

 

Here is the code I am using:

<?php

$videoid = $_GET['videoid'];

include('connect.php');

$query = "SELECT * FROM `video` WHERE `id` = '$videoid'";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $videotitle; ?></title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="container">

	<h1>Ilkley Skateboarding - News</h1>

	<?php include('navigation.php'); ?>

	<div id="content">

		<?php
		$result = mysql_query($query) or die (mysql_error());

		while($row = mysql_fetch_array($result)) {

			$title = $row['title'];
			$description = $row['description'];
			$videourl = $row['videourl'];
			$starring = $row['starring'];
			$filmedby = $row['filmedby'];
			$editedby = $row['editedby'];
			$filesize = $row['filesize'];
			$cameraused = $row['cameraused'];
			$youtube = $row['youtube'];
			$mp4 = $row['mp4'];
			$date = $row['date'];
			$postedby = $row['postedby'];

			if(strlen($youtube)>10) {
				$youtube1 = "<a href='$youtube' target='_blank'>YouTube</a>";
			} else {
				$youtube1 = "";
			}

			if(strlen($mp4)>10) {
				$mp41 = "<a href='$mp4' target='_blank'>.MP4 (right click then save as)</a>";
			} else {
				$mp41 = "";
			}



		?>
	  <div class="post">
			<h2><?php echo $title; ?></h2>
			<embed src="<?php echo $videourl; ?>" width="320" height="256" pluginspage="http://www.apple.com/" border="0"></embed>
			<ul id="videodetails">
				<li><strong>Title: </strong><?php echo $title; ?></li>
				<li><strong>Starring: </strong><?php echo $starring; ?></li>
				<li><strong>Filmed By: </strong><?php echo $filmedby; ?></li>
				<li><strong>Edited By: </strong><?php echo $editedby; ?></li>
				<li><strong>Camera Used: </strong><?php echo $cameraused; ?></li>
				<li><strong>Filesize: </strong><?php echo $filesize; ?></li>
				<li><strong>Other Formats: </strong><?php echo "$youtube1 $mp41"; ?></li>


			</ul>
		</div>

		<div class="post" id="comments">
			<h3>Comments</h3>



		</div>

		<div class="post" id="leavecomment">
			<h3>Leave a Comment</h3>
			<fieldset>
			<form id="form1" name="form1" method="post" action="">
			<label for="name">Name:</label><br />
				<input type="text" name="name" /><br />

				<label for="name">Email:</label><br />
				<input type="text" name="email" /><br />

				<label for="name">Comments:</label><br />
				<textarea name="comments" rows="4"></textarea><br />

				<input type="submit" name="submit" value="Submit" id="button" />

			</form>

				<?php

					if(isset($_POST['submit'])) {
						include('connect.php');

						$name1 = $_POST['name'];
						$email1 = $_POST['email'];
						$comments1 = $_POST['comments'];

						$name1 = strip_tags($name);
						$email1 = strip_tags($email);
						$comments1 = strip_tags($comments);

						$date1 = date("m/d/y");

						$query = "INSERT INTO `videocomments` (`name`, `email`, `comments`, `date`, `videoid`) VALUES ('$name1', '$email1', '$comments1', '$date1', '$videoid1')";
						$result = mysql_query($query);

						echo "Thanks!";

					}

				?>
			</fieldset>
		</div>

		<?php } ?>
	</div>

	<div id="footer">
		<p>Copyright © 2008 Ilkley SB | <a href="admin-home.php">Login</a></p>
	</div>


</div>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/84111-solved-mysql_fetch_array-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.