Jump to content

Recommended Posts

I have this code:

<?php
function centercontent() {
global $template;

if(mysql_num_rows(mysql_query("Select * from video_cat")) == 0){
echo "<div class='error'>Please add a video category first!</div>";
}else{

if($_POST['submit']){
$video_name=clean_up($_POST['video_name']);
$video_link=clean_up($_POST['video_link']);
$video_des=clean_up($_POST['video_des']);
$video_cat=clean_up($_POST['video_cat']);
$video_type=clean_up($_POST['video_type']);

if(!$video_name || !$video_link || !$video_des || !$video_cat){
	echo "<div class='header'>Add A Video</div>";
	echo "<div class='error'>Please fill in all fields!</div>";
	include ('templates/'.$template.'/footer.php');
	exit;
}else{

	if($video_type == youtube){
		$video_link = str_replace("http://www.youtube.com/watch?v=","",$video_link);
		$video_link = str_replace("http://youtube.com/watch?v=","",$video_link);
		$video_link = str_replace("&feature=rec-HM-rn","",$video_link);
		$video_link = str_replace("&feature=related","",$video_link);
		$video_link = str_replace("&feature=fvw","",$video_link);
		}

	if($video_type == dailymotion){
		$video_link = str_replace("http://www.dailymotion.com/video/","",$video_link);
		$video_link = str_replace("http://dailymotion.com/video/","",$video_link);
		$video_link = str_replace("http://www.dailymotion.com/us/lang/en/video/","",$video_link);
		$video_link = str_replace("http://dailymotion.com/us/lang/en/video/","",$video_link);
		}

	if($video_type == metacafe){
		$video_link = str_replace("http://www.metacafe.com/watch/","",$video_link);
		$video_link = str_replace("http://metacafe.com/watch/","",$video_link);
		}

mysql_query("INSERT INTO video 
`video_name`='$video_name',
`video_link`='$video_link',
`video_des`='$video_des',
`video_cat`='$video_cat',
`video_by`='{$_SESSION['username']}',
`video_type`='$video_type'") or die(mysql_error());
echo '<div class="done">Video Added!</div><br />';
}
}


echo "<div class='header'>Add A video</div>";

   echo "<form action='admin.php?action=addvideo' method='post'><div class='content'>
<b>Name:</b><br />
<input class='tarea' type='text' name='video_name' size='30'><br />

<b>Link: <small>(URL location of the video)</small></b><br />
<input class='tarea' type='text' name='video_link' size='30'><br />
<small><a style='color:red;'>If its from metacafe.com, please leave off the / at the end of the link</a></small><br />

<b>Description:</b><br />
<textarea class='tarea' name='video_des' rows='5' cols='40'></textarea><br />

<b>Category:</b><br />
<select class='tarea' size='1' name='video_cat'>";

$cat=mysql_query("Select * from video_cat");

while($cat2=mysql_fetch_array($cat))
{
$catname=clean_up($cat2[vid_cat]);
$catid=clean_up($cat2[vid_id]);
   print "<option value='$catid'>$catname</option>";

}

print "</select><br />";

echo "<b>Video Site:</b><br />
<select size='1' name='video_type'>
<option value='youtube'>Youtube</option>
<option value='dailymotion'>Daily Motion</option>
<option value='metacafe'>Metacafe</option>
</select><br />";

echo "
         <input type='submit' name='submit' value='Add'></div></form>";

}

};

$title="$tt_admin_addvideo";
?>

 

I dont see what could possibly be wrong with it.. but I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`video_name`='Casting Crowns - Does Anybody Hear Her', `video_link`='uhOJW4Uwy3c' at line 2

 

Any help would be greatly appreciated,

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/173987-solved-mysql-error-help/
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.