PHP Write to SQL database

<?php
//write_to_sql.php
//Written by David Kull 07042008
//———————-
// $host = “localhost”;
// $user = “”;
// $pass= “”;
// $table = “”;
// $database = “”;
//———————-require_once(“config.php”);

//stores the URLvariables into variables that php can use
$one =tiny_mce_marker

GET[‘MovieTitle’];
$two =tiny_mce_marker

GET[‘MovieFilename’];
$three=tiny_mce_marker

GET[‘MovieCatagory’];

// Connects to the database server
$dbcnx = @mysql_connect($host, $user, $pwd);
if (!$dbcnx) {
echo( “<P>Write to sql – Unable to connect to the database server {$host}.</P>” );
exit();
}

// Selects the database
if (! @mysql_select_db($database) ) {
echo( “<P>DK, Im Unable to find database : {$database}.”);
exit();
}

//this is the command used to write the record into the MySQL database
$query=”INSERT into {$table} (Title, FileName, Catagory) VALUES (‘{$one}’, ‘{$two}’, ‘{$three}’)”;

//executes the command
mysql_query($query) or die(“DK, Data not written: {$table} : {$one} : {$two} : {$three}.”);
echo(“The data {$one}, {$two}, {$three} has been inserted into table:{$table}! “);
?>

Tags: , ,

Leave a Reply

You must be logged in to post a comment.

My Latest Video
Weather forecast in San Bernardino
My Photos on Pond 5
Royalty-Free Stock Video at Pond5
Posts
Speedtest 2014 B
Speedtest.net Mini requires at least version 8 of Flash. Please update your client.
Speed Test
Recent Posts
    Sponsers
    Your IP Info
    Login