Xml problems

in this code i am using i can link to an image and there are two spots that are for text. i dont need the text spots “comment” or “title”. what i do need is the image and here is the problem. i would like to have the image click to a url. i guess i need to by able to attach a link to the image. here is the xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data[
	<!ELEMENT title (comments, image)>
	<!ATTLIST title name CDATA #REQUIRED>
	<!ELEMENT comments (#PCDATA)>
	<!ELEMENT image (#PCDATA)>
]>
<data>
	<title name="">
		<comments></comments>
		<image>images/FeaturedEvent/impact.jpg</image>
	</title>
	<title name="">
		<comments></comments>
		<image>images/FeaturedEvent/lee.jpg</image>
	</title>
	<title name="">
		<comments></comments>
		<image>images/FeaturedEvent/newBuild.jpg</image>
	</title>
	
</data>

do you need XML? Are the image urls the only things you’re after?

the reason i was using xml is so that the client could change the image names that get put into the flash file and also so they could change the link. it does not need to be xml, just some sort of system that will allow these things to happen.

rL

can anyone think of a any other way to load the picts in and have them be linkable. also i want to be able to change the links on the images often

Yea, I just wrote a small PHP/mySQL system where the admin can upload images, and then those images can be displayed in flash.

Here’s some code snippets:
uploadImage.php (thanks to someone around here for get who)


<?php

$uploaddir = 'images/';   //this is my main image directory
$uploadfile = $uploaddir . $_FILES['userfile']['name'];

while (file_exists($uploadfile))
   {
       die("File Exists, Please rename your file");
   } 

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile));

$dbhost = ""; 
$dbuser = ""; 
$dbpwd  = ""; 
$dbname = "";  // change this to your database name
$connection = mysql_connect($dbhost, $dbuser, $dbpwd);
mysql_select_db("$dbname",$connection);
$id = $_POST[id];
$dir = $uploadfile;
$desc =$_POST[desc];

//print $id;
echo $id;
echo $dir;
echo $desc;

mysql_query("INSERT INTO file_uploader(file_id,file_directory,file_description)VALUES('$id','$dir','$desc')");
echo "File uploaded successfuly.";
?>

if you wanted you can load the images into flash
sendtoflash.php


<?php

 $connect = mysql_connect("", "", "");
        mysql_select_db("", $connect);
        $result = mysql_query("SELECT file_directory, file_description FROM file_uploader");
        $cant = 0;
        while($row=mysql_fetch_array($result)){
            echo "Comments$cant=$row[file_description]&Image$cant=$row[file_directory]&";
            $cant++;
        }
        echo "cant=$cant"; 
		
?>

or just view them on a php page and link the title to the images

lookupstuff.php


<html>

<head>
<title>:: Look Up Stuff ::</title></head>

<body>

<?php
// set up some variables
// server name
$server = "";
// username
$user = "";
// password
$pass = "";
// database to query
$db = ""; // make sure you change this to your database name

// open a connection to the database
$connection = mysql_connect($server, $user, $pass) or
die("Invalid server or user");

// formulate the SQL query
$query = "select * from file_uploader" or die("Error in query");

// run the query on the database
$result = mysql_db_query($db, $query, $connection) or
die("Error in query");

// display the result
while($myrow =  mysql_fetch_array($result))
{   
    $id =  $myrow["file_id"];
    $dir = $myrow["file_directory"];
    $de = $myrow["file_description"];
    
?>

<br>

<a href="<?php echo $dir; ?>">Your Image</a><br>

<?php
echo $de; ?><br><?php
}    
// memory flush
mysql_free_result($result);
?>
<br>
<br>
These are the files that were uploaded to the web server through the form. Only the first 2 files show in flash.<a href="viewImages.php"><b><br>
View Flash Page</b></a>
</body>
</html>

Unfortunaly i destroyed the database so i dont have the sql file. hope that helps

that does help thanks i will try to come up with version of my file that uses this

your welcome repost if you have a problem or any questions