| Newbie | | Join Date: Oct 2009
Posts: 15
| |
| re: Sliding menu of images
Hi Guys
I have this piece of code that is supposed to produce XML from data retrieved from database Garant. Could anyon tell me why it has stopped working? Its bound to be syntax again but I would appreciate a second pair of eyes to look at it.
Regards FJW - <?PHP
-
// slider.php
-
require("./resources/globals.php") ;
-
// Generate the SQL command for doing a select from the Database
-
$query = "SELECT smallpic,Ref,Pic1 FROM Garant LIMIT 10";
-
-
// Connect to the Database
-
$link=mysql_connect($location,$userName,$passwor d) or die (mysql_error());
-
mysql_select_db($dbname) or die (mysql_error());
-
$results=mysql_query($query) or die (mysql_error());
-
-
// Select the Database
-
if (!mysql_select_db($dbname, $link)) {
-
DisplayErrMsg(sprintf("Error in selecting %s database", $dbname)) ;
-
DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link))) ;
-
exit() ;
-
}
-
// Execute the Statement
-
if (!($results =mysql_query($query, $link))) {
-
DisplayErrMsg(sprintf("Error in executing %s stmt", $query)) ;
-
DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link), mysql_error($link))) ;
-
exit() ;
-
}
-
// Display the results of the query
-
//header("Content-type: text/xml");
-
$linkID = mysql_connect($localhost, $userName, $password) or die("Could not connect to host.");
-
mysql_select_db($dbname, $linkID) or die("Could not find database.");
-
-
$resultID = mysql_query($query, $linkID) or die("Data not found.");
-
$xml_output = "<?xml version=\"1.0\"?>\n";
-
$xml_output .= "<images>\n";
-
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
-
$row = mysql_fetch_assoc($resultID);
-
$xml_output .= "<image src=\"images/tn/";
-
$xml_output .= "".$row['smallpic']."";
-
$xml_output .= "\" title=\"\" url=\"images/";
-
$xml_output .= "".$row['Pic1']."";
-
$xml_output .=" \">\n";
-
}
-
$xml_output .= "</images>";
-
echo $xml_output;
-
?>
|