Jump to content

Can't Insert Title Into Database (Split From Existing Thread)


Recommended Posts

Hi, I am newbie in PHP and I got some script which I just can't get to insert title in database. I would be very thankful if you could help me with this. Here is the code. I hope that trg86 doesn't mind I got in his topic.

 

$surl = $_SERVER['HTTP_HOST'] ;

 

if (strip_tags($_POST['add'])){

$vidid=mysql_real_escape_string(strip_tags($_POST['vidid']));

 

$url = "$vidid";

parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars);

 

$t1=mysql_real_escape_string(strip_tags($_POST['tit1']));

$title="$t1";

parse_str( $title, $my_vars );

 

mysql_query("INSERT INTO `videos` (`id`, `videoid`, `views`, `title`) VALUES ('', '".$my_array_of_vars['v']."', '0', '".$my_vars['v']."');") or die (mysql_error());

$message="<img src=\"../img/tick-icon.jpg\">";

}

if (strip_tags($_POST['rem'])){

$vidid2=mysql_real_escape_string(strip_tags($_POST['vidid2']));

 

$url = "$vidid2";

parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars );

 

mysql_query("DELETE FROM videos WHERE id=".$my_array_of_vars['v']."");

 

$message2="<img src=\"../img/tick-icon.jpg\">";

}

?><head>

<html xmlns:fb="http://ogp.me/ns/fb#">

<title>Admin Panel</title>

<META name="robots" content="NOINDEX,NOFOLLOW" />

<link type="text/css" rel="stylesheet" href="../css/admin.css" />

<link href="../img/favicon.ico" rel="icon" type="image/x-icon" />

 

<body>

 

<a href="index.php"><img src="../img/logo.png" border="0"></a>

<div class="banner"><a href="index.php">Delete</a> - <a href="add.php">Add & Remove</a> - <a href="logout.php">Logout</a></div>

 

<div align="center"><form id="form1" method="post" action="">

 

Youtube URL: <input type="text" name="vidid" id="vidid">

Title: <input type="text" name="tit1" id="tit1">

<input name='add' type='submit' id='add' value='Add Video' /> <? echo"$message";?><br><br>

 

Website URL: <input type="text" name="vidid2" id="vidid2">

<input name='rem' type='submit' id='rem' value='Remove Video' /> <? echo"$message2";?><br><br>

Example: <strong>http://<? echo"$surl"; ?>/watch.php?v=25</strong>

</div>

</form>

</body>

Edited by Nina555
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.