View Full Version : Adding streams manually to the database

12-11-2010, 06:12 PM
I have downloaded and installed the script without any problem, but after using it and playing around for a while in the admin area i decided to add some new channels.

I added some via the admin area but wondering how easy it would be to add a channel by using mysql?

12-12-2010, 10:30 AM
Hi Bob,

By far the admin panel is the easiest way to add channels as that supplies the right fields to add to the database, but you can do it manually if you want.

I presume you mean you would like to add channels via a php script and add it using mysql, if so read on.

first we will include config.php to pick up the database info, then we make a connection and open the db.

include("config.php"); //Included to pickup your db info
mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error());
mysql_select_db($dbname) or die (mysql_error());

Next we set up the variable to hold our channel info.

$channel="the channel name";
$streamurl="the url to the actual stream"; //usually found in html embed and object code
$country="the country the channel is from";
$category="the category the channel belongs to";
$discription="a short discription for the channel";
$player="the player type to use"; //either wm or fp for now
Next comes inserting our new channel into the database.

$query = "INSERT INTO tvchannels (`tvid`, `channel`, `streamurl`, `country`, `category`, `discription`, `player`) VALUES (NULL, '".$channel."', '".$streamurl."', '".$country."', '".$category."', '".$discription."', '".$player."')";
$result = mysql_query($query) or die (mysql_error());

That is how you would use php and mysql to add a channel.