php read from sql database

<?php
header(“Content-type: text/xml”);//read_from_sql.php
//Written by David Kull 07042008
//———————-
// $host = “localhost”;
// $user = “root”;
// $pwd= “”;
// $table = “tablemovie”;
// $database = “movies”;
//———————-

require_once(“config.php”); //php file the contains host, user, pwd, table, database

$one =tiny_mce_marker

GET[‘MovieTitle’];
$two =tiny_mce_marker

GET[‘MovieFilename’];
$three=tiny_mce_marker

GET[‘MovieCatagory’];
// Title, FileName, Catagory

$linkID = mysql_connect($host,$user,$pwd) or die(“DK, I Could not connect to {$host}.”);
mysql_select_db($database, $linkID) or die(“DK, I Could not find database : {$database}.”);

$query = “SELECT * FROM {$table} limit 500”;
$resultID = mysql_query($query, $linkID) or die(“Data not found. {$table} {$title} {$one} {$two} {$three}”);

$xml_output = “<Movies>\n”;

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$y = $x +1;
$row = mysql_fetch_assoc($resultID);
$xml_output .= “\t<entry>\n”;

$xml_output .= “\t\t<Title>” . $row[‘Title’] . “</Title>\n”;
$xml_output .= “\t\t<FileName>” . $row[‘FileName’] . “</FileName>\n”;
$xml_output .= “\t\t<Catagory>” . $row[‘Catagory’] . “</Catagory>\n”;

$xml_output .= “\t</entry>\n”;
}

$xml_output .= “</Movies>”;
echo $xml_output;

?>

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
    Tech
    Your IP Info
    Login