Jump to content

Recommended Posts

when i try to add a video to my website it says video not upload to database for somereason but i dont know were to fix it i look and look and cant find the problem i already have my tables create for adding videos help plz

 

 

 

 

 

 

 

<?php $title = "Add Video"; ?>
<?php require("styles/top.php"); ?>

<div id='left'>
<?php

if ($username){

	$categories = "
	<option value='Games'>Games</option>
	<option value='Music'>Music</option>
	";

	$form = "<form action='$site/addvideo' method='post'>
	<table>
	<tr>
		<td>Title:</td>
		<td><input type='text' name='title' style='width: 450px;'></td>
	</tr>
	<tr>
		<td>Description:</td>
		<td><textarea name='description' style='width: 450px; height: 100px;'></textarea></td>
	</tr>
	<tr>
		<td>Keywords:</td>
		<td><input type='text' name='keywords' style='width: 450px;'></td>
	</tr>
	<tr>
		<td>Category:</td>
		<td><select name='category' style='width: 455px;'>
			<option value=''>Select One</option>
			$categories
		</select></td>
	</tr>
	<tr>
		<td>Video ID:</td>
		<td><input type='text' name='videoid' maxlength='20' style='width: 450px;'><br />
		Not the entire URL just the video ID! Just the part in RED!!!<br />
		http://www.youtube.com/watch?v=<font color='red'>SoKQz065aQU</font></td>
	</tr>
	<tr>
		<td></td>
		<td><input type='submit' name='addbtn' value='Add Video'></td>
	</tr>
	</table>
	</form>";

	if ($_POST['addbtn']){
		$title = $_POST['title'];
		$description = $_POST['description'];
		$keywords = $_POST['keywords'];
		$category = $_POST['category'];
		$videoid = $_POST['videoid'];

		if ($title){
		if ($description){
		if ($keywords){
		if ($category){
		if ($videoid){
			if (strstr($categories, "<option value='$category'>$category</option>")){
				require("scripts/connect.php");

				$query = mysql_query("SELECT * FROM videos WHERE videoid='$videoid'");
				$numrows = mysql_num_rows($query);
				if ($numrows == 0){

					$date = date("F d, Y"); // October 09, 2010
					mysql_query("INSERT INTO videos VALUES ('', '$userid', '$username', '$title', '$description', '$keywords', '$category', '$videoid', '0', '0', '$date')");
					$query = mysql_query("SELECT * FROM videos WHERE user_id='$userid' AND title='$title' AND videoid='$videoid'");
					$numrows = mysql_num_rows($query);
					if ($numrows == 1){
						$row = mysql_fetch_assoc($query);
						$id = $row['id'];

						echo "Your video has been added. <a href='$site/videos?id=$id'>Click here to view it.</a>";

					}
					else
						echo "<font color='red'>Your video was not added to the database for some reason.</font>";
				}
				else
					echo "You can not add a video that is already in the database. $form";

				mysql_close();
			}
			else
				echo "You did not submit a valid category. $form";
		}
		else
			echo "You did not submit a video ID. $form";
		}
		else
		echo "You did not select a category. $form";
		}
		else
		echo "You did not submit any keywords. $form";
		}
		else
		echo "You did not submit a description. $form";
		}
		else
			echo "You did not submit a title. $form";
	}
	else
		echo "$form";

}
else
	echo "<h2><font color='red'>You must be logged in to add a video.</font></h2>";

?>
</div>

<div id='right'></div>

<?php require("styles/bottom.php"); ?>

Link to comment
https://forums.phpfreaks.com/topic/243740-help-mee-plz/
Share on other sites

thanks dude i made a mistake on

 

mysql_query("INSERT INTO videos VALUES ('', '$userid', '$username', '$title', '$description', '$keywords', '$category', '$videoid', '0', '0', '$date')");

 

i had to take out the extra '0' thanks for helping

Link to comment
https://forums.phpfreaks.com/topic/243740-help-mee-plz/#findComment-1251472
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.