•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 374,147 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,492 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 198 | Replies: 1 | Solved
![]() |
•
•
Join Date: Dec 2007
Location: Oklahoma
Posts: 159
Reputation:
Rep Power: 1
Solved Threads: 16
Hello
I have been working on this script for a little while. All is working good(get all information into the xml). But I am needing to have the php code add an image to the xml for download. If anybody as any ideas i would greatly appreciate it.
I have this pulling testing info from the MYSQL db. There will be an image that will need to be added to this document.
I have been working on this script for a little while. All is working good(get all information into the xml). But I am needing to have the php code add an image to the xml for download. If anybody as any ideas i would greatly appreciate it.
I have this pulling testing info from the MYSQL db. There will be an image that will need to be added to this document.
if(isset($_POST['file_name'])) {
$xml_dec = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
$rootElementStart = "<user>";
$rootElementEnd = "</user>";
$xml_doc = $xml_dec;
$xmlfilename = $_POST['file_name'];
$userinfo = mysql_query("select userid, firstname, lastname, email from users") or die(mysql_error());
while($row = mysql_fetch_array($userinfo))
{
$xml_doc .= $rootElementStart;
$xml_doc .= "<id>";
$xml_doc .= $row['userid'];
$xml_doc .= "</id>";
$xml_doc .= "<name>";
$xml_doc .= $row['firstname']." ".$row['lastname'];
$xml_doc .= "</name>";
$xml_doc .= "<email>";
$xml_doc .= $row['email'];
$xml_doc .= "</email>";
$xml_doc .=$rootElementEnd;
}
$default_dir = "testing/";
$default_dir .= $xmlfilename.".xml";
$fp = fopen($default_dir,'w');
$write = fwrite($fp,$xml_doc);
//header($default_dir);
echo $default_dir;
echo "Document has been written successfully!";
}
?>![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- Read XML File in C/C++ (C++)
- XML or XSL or What?? (XML, XSLT and XPATH)
- XML Bug Error. (XML, XSLT and XPATH)
- HTTP GET and POST REQUEST (Java)
- Slideshow Des/Dev - PHP/SQL/XML/FLASH/AS/AJAX, not all needed but it wouldn't hurt. (Web Development Job Offers)
- Searching and Comparing strings from an XML Document (Python)
- Getting info from an XML file (PHP)
- Parse XML from ASP!!! (ASP)
- XML save settings (C#)
Other Threads in the PHP Forum
- Previous Thread: Variables in Variables
- Next Thread: Write a one echo statment from html


Linear Mode