Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Exporting To An XML File


I grabbed a web page and had it extract only the links between certain line numbers. Now I want to take that output and export it to an XML file in a format of my choosing. For example:

<a href="mysite.com">This is my site</a>

Would export to:

<link>mysite.com</link>
<description>
This is my site
</description>

I will then take that XML file and output it as HTML, however I already have this bit accomplished.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Exporting DB Results (or Flat File) To An Excel File
I have two scripts, neither of which have been written, that will need to collect user information. They will either write to a flat file or to a MySQL DB, and I need a way for an administrator to grab an Excel file based on this data.

First, no more than 100 people are expected to sign up, so flat file is certainly viable. Do you recommend I use DB or flat file?

Second, based on your recommendation, how should I go about exporting the user data to an Excel file? There will be about ten form fields per registration to give you an idea.

Exporting Csv File
I'm having issues getting all the information from 3-4 databases into one
csv file.. What easy thing am I missing this time?

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=export.csv");
header("Pragma: no-cache");
header("Expires: 0");
$select = "SELECT * FROM ordersCopy O, orders_products P, orders_total Q
WHERE O.orders_id=P.orders_id OR O.orders_id=Q.orders_id AND
orders_status=&#393;'";

$export = mysql_query($select);
$count = mysql_num_fields($export);
for ($i = 0; $i < $count; $i++) {
$header .= mysql_field_name($export, $i)." ";
}
while($row = mysql_fetch_row($export)) {
$line = ''
foreach($row as $value) {
if ((!isset($value)) OR ($value == "")) {
$value = " ";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . " ";
}
$line .= $value;
}
$data .= trim($line)."
";
}
$data = str_replace("
", "", $data);
if ($data == "") {
$data = "
(0) Records Found!
";
}
print "$header
$data";

Exporting From Db To Text File
I have the following sql statement that works from phpmyadmin and from the MySQL command line, but not php. The resultant $sql variable is the following:

$sql=select logrecno, county, sumlev
into outfile "/tmp/census.txt"
fields terminated by ','
lines terminated by ""
from sf1_msageo
where sf1_msageo.county=97 and sf1_msageo.sumlev=140

$result=mysql_query($sql); The query executes, returns no messages, and does not create a file. Any idea as to what I'm doing wrong?

File Exporting To Excel
This code exports data from my DB into an Excel file by using " " as the delimiter. It runs through the script over and over until it's done creating an Excel file with columns of data, but is there a way that I can add a value to the beginning of the script - thereby naming the columns? Code:

Exporting MySQL Database To File Using PHP
I want to export my database to a file that is hosted on the same server. I got this script from somewhere, but it doesnt work. Most likely because I cannot access mysql command thru the shell_exec() command, however, I am able to use the wget command thru the shell...

Here's the code I was trying to use:

Exporting Search Results To A CSV File
I am about to start programming up a database, where the client requies the data exported to a CSV file for use in mail merge documents etc.

What I would like to know is, if they run a query on the database, and only export five of the 10 fields in the table to the list, how would I go about reatining the field names on the first line of the CSV file?

CSV Exporting
I created the csv file, but it only shows the last record in my db. How can I make it show all of the records? Here's the code:

Exporting A Database
developed a php project using mysql as the database.i work on a win-nt machine....how do i export my database to the host server which runs linux???

PHP Exporting To Quickbooks
I am working on a web-based payroll application (PHP/MySQL of course) that needs to be able to dump each employee's information in to a Quickbooks formatted file for payroll processing.

I have done this several times exporting to a tab/comma deliminated text file (usually MS Excel), but I was wondering if anyone could see any reason why it could not be done the same way (assuming that Quickbooks uses a a tab/comma file structure) for Quickbooks??? If it can be done would I use the same mechanics as I would for Excel (changing the file type meta tag)?

Database Exporting
Quite by accident, I found the mysqldump utility, that comes with MySQL,
which dumps/backsup a database, table, or record. It looks very versatile!

Does PHP have a way to export records of a MySQL database? Anything that
does the same independent of the database used?

Database Exporting
As part of the CMS that I've written, I would like to give users the ability
to backup their own databases. Is there any way that this can be done with
PHP? What I'd like is for them to click a link and for it to create a txt
file and open the "Save as" dialog box so that they can save it off to their
hard drive.

Exporting Mysql
there is a function in phpmyadmin that exports all the data etc from a mysql
database to an sql text document, or Excel File.

I would like to know if there is an inherent way of doing this without
phpmyadmin. - straight through php.

Exporting From MySQL To .csv Using PHP
I'm sort of new to PHP. I am using the following code to retrieve a
column from a database and to put all of the results into a .csv
file. This allows creates a .csv file, but only lists the first
result from the database. It is not returning all of the rows. I
know the issue is somewhere in my "foreach" but I'm not sure where.

<?php

$selectSql = "SELECT artist_name FROM lounge_products";
$selects = $db->getAll($selectSql);

foreach($selects as $select) {

$content = $select[artist_name].",";

}

Header("Content-Disposition: attachment; filename=export.csv");
print $content;
?>

Exporting To Excel
I followed the really cool how to at http://www.phpfreaks.com/tutorials/114/0.php but I had to change some things to get it to stop giving me errors. After I did that It seemed to work great but it put everything into one cell in the excel document. Code:

Exporting MySQL Table
Hi,

How do you export a MySQL table to a tab-delimited text file so I can put it into excel?

Exporting To Microsoft Access
I have a PHP website with a mySQL database and a client wants to be able to see the database on his computer using Microsoft Access.

I would like to be able to make a special backdoor section for him, where he enters his username and password and is given a link which will make take a snapshot of the mySQL database and convert it to a Microsoft Access database which he can download to his computer.

Is this possible?

Since he isn't very computer savvy I need a way as user friendly as possible to let him download the database and view on his local computer.

Exporting Mysql To Csv Or Excel Via PHP
Hi, I need to know how to write a php code how to export the mysql database into CSV or Excel or ISO 20001 format. or if you know any tutorial site for it.

Exporting Data To MS Excel
How to export data to xls file using PHP? Is it possible to edit a
look of document (like cell size, borders etc.) ?

New Exporting / Getting News From Different Server
Which is the best way to fetch news from my server and display it on other sites. I have an admincp i would like to display announcements in from my site. Maybe just some how remotly including a file from my server or something.

Exporting Mysql Data To CSV In Php Code!!
how can i export the results of a query to a csv file with the columns name in the filed name of the csv???suppose USERID is the 1st column the USERID should be named in A in CSV while its data is under of it??is it possible?

Exporting Information From Entourage To A Website.
I have this new website for a client, it has a calender which shows events from a mysql database but they don't want to have to update the information to it manually.
What they are using is a program called Microsoft Entourage. What are the possible ways for me to be able to get that information every 1 hour and get it into a database?

BBCode Parsers And Exporting Text From A DB
I'm currently working on a simple (at least I had hoped) script to pull posts from a single "news" forum from phpbb and importing it on the front page of my site. It works great except for the BBCode issues.

It doesn't keep line breaks (biggest concern) as well as text colors, urls, etc (which was expected).  Talking with a friend, he tells me that I'm going to have to insert some BBCode parser to make things work right.  I have 3 questions regarding this:

1) is that my only answer?

2) should I try to use the phpbb BBCode parser that the forum uses?

3) should I install a custom BBCode parser instead?

I did not want to use a portal because they were just over bloated for what I needed and that was simply the posts from the forum itself w/o all the extras like who's online, last post made on the forums, etc.

Would it just be easier to try to strip down something like EZportal to just the info I need instead of trying to use this custom script?

Problems While Exporting Data Using Pipe Symbols
I am facing problems while trying to export data into
pipe format. In fact I am fetching records from mysql database and then
trying to create a text file ( using pipe as delimeter) , intending to
open in Excel.

The data is been inserted from textarea fields, where the
user can write text and may press enter key to format his text
accordingly. Now when the data entered into the database it keeps some
unidentified value so as to keep the formatting. Hence while displaying
the text file I find that lines are seperated according to the format
user gave. Thus creating the problem while opening up in the excel
file.

example:

Exporting Database To Excel (via Website, NOT PhpMyAdmin)?
I know via phpMyAdmin I can export my database in Microsoft Excel 2000 format, and can check a box to 'Create field names as first row', but it doesn't give me the php code used to achieve this. I need to have a page on a website so the administrators will be able to do this for themselves, does anyone know if this is possible?

Exporting Data From Mysql Using Php In Excel Form..?
I have a table in mysql wich contain a sim_number field which is 19 digit unsigned number. i have designed a script using php headear command for exporting data as excel. It is working but with the follwoing problem.
Since sim_number is 19 digit number when it get exported as .xls file. now when that .xls file is opened, excel automatically detect this sim_number as number and , since excel can store only 15 digit in number format it converts its last 4 digits to zeros.

Is there any way to get this sim_number exported as text so that excel store complete 19 digit number in text format. I cannot attach some charctor to this sim_number because of restricion on file format.

To Get A File Name, File Size, File Type...?
Is there a way to get information about a file BEFORE it is submitted to the server?
I am trying to make a upload progress bar from scratch WITHOUT THE PRON.C PHP FIX!!!
I found the file being uploaded in my NET://WINN01910//TEMP folder and I can outputs its file size in a popup with a one second refrehs, but this makes it so the USER needs to know the full file size to know if its anywehre near done. 

Is there a way to get the filesize from the clients side?  Possibly javascript that uses ajax to submit the values to the server before the file is sent but when it is selected?? Is there an easier way to do this and/or do you have any ajax example code of how it might work?

I also have another problem, Althoguh i can echo the filesize of what is recieved so far, I am just glob()ing the temp folder for: "php*.tmp" but is there a way to tell the tmp file so they don't see everyone's uploads?

FIle Uploads: Empty _POST And _FILES Arrays When File Too Large
Uploading of files.. AFAIU from the manual, if a file is larger than the
size defined in the form or larger than upload_max_filesize in php.ini,
that _FILES['file']['error'] should hold an INT error code.

The file upload system is working fine if the file is smaller than the
defined size, but if it's larger, then both the _POST and _FILES arrays
are completely empty:

array(0) {
}

I can obviously check to see if $_FILES is set and contains elements,
but I was hoping for more specific error handling (reason as to why the
upload failed).

Has anyone else encountered this? Any info welcomed =)

Checking File Existence Through A List Of File Locations Gathered From An Array
I've been trying to wrote a code to check the existence of some files gathered from a field in mySql database.

And I am kind a stuck at a point where I get the file locations from the database but when it passes those locations to file exist it keeps telling me the file does not exist.

Only first file exists the other 2 file does not exist to test if the code was working or not. Code:

Email With File Attachements - How To Upload File To Server From Browser?
I have a PHP script that sends an email with attachment and works great when
provided the path to the file to send.

However this file needs to be on the same server as the script.

I want to develop a webpage where people can send attachments that are
stored on their local PC.

I know I can use the <input type="file" > HTML to generate a file box that
allows the user to navigate to a file on their PC and product a file path,
but how do I then upload this file onto file server to email out with my PHP
email script?

Is there an easy way to do this?

Or can I approach this problem from a completely different angle.

Creating Link To File Or Temp File For User Download
I am designing a document management system (DMS). The files are stored
in a directory on the webserver. The filenames for the documents are
stored in a MySQL database. The DMS will track revisions from the
initial version through the updates. We must have strict permissions
set so only authorized personnel can access some documents. All of the
documents when uploaded are given totally random names such as
"114723fb5422c6bd5ed18f6.doc". Is there a way, without the webserver
creating a new file name "document_specs_ver2.doc" to have the file
download named "document_specs_ver2.doc".

If I must physically create a new file, how do I know when the
webserver would be allowed to delete it? Notes: The files will be in
several different file formats, not just "doc".

Header Function, File Download, Temp File Disappears
I have the following headers:

if (preg_match("/compatible; MSIE/i", "$browser_type")){
header("Content-Tranfer-Encoding: binary");
header("Content-type: ".$assoc["type"]."");
header("Content-Disposition: attachment; filename="".$assoc["name"].""");}
echo $assoc["file"];

which starts the download of an mp3 file in one particular case. If you do not save target as and just select 'open' the temp file is zero bytes even though the download process took a while and showd how much progress you were making. So something is happening to the temp file.

Warning: File(): URL File-access Is Disabled In The Server Configuration
Does any one know how to work around this error on a web site?

Warning: file(): URL file-access is disabled in the server configuration ...

Load .txt File From Computer And Save The File In Www/folder Director
anyone know how to add the .txt file from computer into the localhost www/Myfolder directory.

Download File And Delete File From Server With One Button Click
I want the user to be able to download a CSV file and delete the file from the server all with the click of a button.  Currently, in firefox, it will just display the CSV and not delete it. In IE, it will download the CSV and not delete it. Code:

Open File, Put First 5 Lines Into A Variable, Close File...
1) I want to open a file on my server.
2) I want to read only the first 5 lines.
3) Put the first five lines into a variable.
4) Close the file.
5) Display the contents of the variable.

I know how to use the fopen() but I have big problems just trying to read the first 5 lines only? I tried many things. I downloaded some search scripts which displayed the <meta> tag only from html pages...

What is this guy doing?

Well I have a big site and content is added and changed everyday. I have a dynamic page that reads a directory for files and then puts a link (well it includes the file for reading on my php page). That works great! MY PROBLEM is that I want not only a link but a small description below it (basically the first five lines on the file)...

See so far:
Quote: if (isset ($content)) {
include ("files/$content.html");
echo "<p><A HREF="read.php"><b>Back to index</b></A>";
} else {
echo "<b>Opening directory, reading files, and listing them as a link</b><p>";
$handle = opendir('./files');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo eregi_replace (".html", "", "<A HREF="read.php?content=$file">$file</a><p>");
}
}
closedir($handle);
}

Open .php File With PHP Designer 2007 By Clicking The File In XP
In windows XP, I want to be able to click on a .php file and have it
opened in PHP Designer 2007,
Or right-click on it and have an "edit" menu option presented to me.
I know how to tweak the registry to do this in general, but what would
the command line look like in this specific case ?
PHP Designer does not do this automatically. It is as if the program
does not allow commandline options.
It only opens with the last file used or a menu of recently opened
files.

PHP File Upload Unexpected Error - File Too Large?
I have a short basic script to upload files. It works fine with small files,
but with longer files it gets stuck.

Here's the fragment, the input file is loaded in "$file" from an HTML form
as usual.

....
$img_str = fread(fopen($file, "r"), filesize($file));
$data = addslashes($img_str);
// --------------------- up to here the execution is correct and fast (<1
second)

$sql="INSERT INTO $table (".
" file_name,".
" file_type,".
" file_size,".
" bin_data)".
" VALUES (".
" '$file_name',".
" '$file_type',".
" '$file_size',".
" '$data')";
// --------------------- it gets stuck
here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mysql_query($sql) or die ("SQL error ..$sql");

I have already set the php.ini variables as follows:
memory_limit = 16M
upload_max_filesize = 6M

I also checked the execution time to max_execution_time = 300 (even though I
don't believe it should be necessary).
The server is a P4 1.8 GHz, 256MB RAM

Displaying File Path In File Input Field
i have file input field in a form like this:
<input name="isbn" type="text" size="25" value="<?php echo
$_POST['isbn'] ?>" />
<input name="image" type="file" size="25" value="<?php echo
$_FILES['image']['name'] ?>" />

when i press "submit" button, the same page gets loaded... if my
$_POST['isbn'] is empty, i want to have the file path on "file input
field" to redisplay on that same field... it's possible in text input
field but i don't know of a way to do it in file input fields...

PHP/IIS: File Read/Write OK, File Unlink Denied
I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP:
4.3.11).

In PHP, the user uploads a file, which is then processed and the
contents are inserted into a new file, created in PHP, onto the server.

This bit works fine, the new file created by PHP is correctly stored.

Later, once the user confirms the upload and PHP inserts the contents
of the file into the DB, the code tries to remove the file created in
PHP moments earlier, via the unlink() function.

What I see on screen is the following: Permission denied

I have made sure that the permissions for the Internet account that
created (and is trying to delete) the file have full permissions over
this particular folder and the files within it. But the user must have
permission anyway, because they are able to create this file in the
first place.

I've looked at the permissions for the file in PHP, which read: 0666.
So everthing *appears* ok to me; I can't see where the permission issue
is coming from.

Mkdir() How Do I Automatically Make A Index File And A Css File
using mkdir() how do i automatically make a index file and a css file. what i really mean is once the directory has been made how do i make it so i have a index and css file there, its just because im making a forum hosting service and i need all the files automatically set up in the directory. how can i do this?

How Can I Find Out Parent (including) File Of Included File?
How can i find out parent (including) file of included file?
Lets imagine that we want to for example auto_prepend file to each file on our server that would write out the name of file  its being executed. I know, i can use PHP_SELF but what if i want to write name of file which is already included?

I have a web page and i want on it show its name even if it was included, but not the included page itself is showing name but auto_prepend file to each php file, its duty of this auto_prepend_file to write it out i dont want myself to echo it on each page? do you feel me?

Php File To Call On A File In A Password Protected Directory
Does anyone know is I can have php file calling on a file in a password protected directory (through basic authentication)?

File Upload Script - Testing For Existence Of File
i'm having a strange problem when processing some form data. I just want to validate that required fields have been populated, then, if an image has been uploaded, i want to ensure that a description of the image has been provided (for alt tag purposes) before processing the data.

For some reason, when a file hasn't been attached, my script interprets it otherwise and prompts the user for the alt tag. I've not come across this problem before, there's a good chance i've done something idiotic but i just can't see it Code:

Write To File Sometimes Deletes EVERYTHING, Leaving Empty File
I've used PHP to save raw data from Flash to an XML in the past. Load the XML into flash, update a couple variables, then send it to PHP to completely overwrite the old .xml file. This works great most of time, but sometimes after a few days, I'll check the .xml and it will be empty (0 bytes).

Not sure if this is caused by a user who aborted during the writing process, or simultaneous connections, etc. Been thinking about doing a backup every day using CRON, but that's a mission and I'd like for it not to happen full stop. Any suggestions?

Script For Grabbing An Xml Rss Feed File Into My Server As Xml File Too
How do I copy using a php or cgi script a remote xml rss feed into my server?

I.E the rss feed:

http://www.lanacion.com.ar/herramie...ex.asp?origen=2

Due to restrictions in flash player 7 I need to load a remote xml rss feed.
I am using load.xml( http://www....

but in that way doesn´t work

The only way that works is when the rss xml feed is placed on my server. I could upload manually the xml rss feed but I need a php script to be called from flash and then parsed. What I need is the script to make that remote xml being "local" to my flash movie.

Trying other stuff Ive found on forums about "proxy scripting" but that only works if you are using flash player 6, flash player 7 even don´t allow redirection scripts at all.

Access Button In HTML File Through PHP File
I’m new to PHP and I’m working on a code and having a problem .
The problem is that I’m having an HTML file like this :

////////////////////////////////////

<p>some text</p> <form action="/project/myfile.php" method="post"> <input type="button" name="mybutton.1" value=" mybutton "><input type="text" name="aaa" /> </form>

<p> some text </p> <form action="/project/myfile.php" method="post"> <input type="button" name=" mybutton.2" value=" mybutton "><input type="text" name="aaa" /> </form>

//////////////////////////////////////

I want to open a new HTML file to the user when he clicks on any of these buttons . I want to do this in the file named “myfile.php “ . What should I write in the file “myfile.php “ to get access to each button and open a new page when the user clicks on it? Is it correct to put " action="/project/myfile.php""? Should I put include the HTML file in my PHP file? I want also to remember which button the user clicks on.

Xsl Imports Relative To Current File Instead Of Xsl File
In the directory /var/www/dynamo/xsl is the basic xsl file for xhtml
documents /var/www/dynamo/xsl/xhtml.xsl. In this file there is an import
statement: <xsl:import href="xhtml/basic.xhtml.xsl" />.
This import statement should load /var/www/dynamo/xsl/xhtml/basic.xhtml.xsl
as far as I know.....

How To Read A File, Edit And Replace That File With New Changes?
I am making a enhancement to our helpdesk product. So we are using JSON for saving the Language defaults. Now I am Using PHP as a server based language. Now here is the logic of the program. Whenever our product is installed then a parser will create a HTML file which will have all the defaults from the JSON file. Now when a user changes the language then the parser will again Run and make the required changes in the JSON file and again create the HTML file and Replace it in that folder. I am not able to find a good solution for this.

Can someone help me building it. I am not able to get how to Open a file, Read it, make the changes and Replace that file.

Uploads An Image File And Moves It To A New File Name
I am having trouble making PHP web page that uploads an image file and
moves it to a new file name. The problem occurs when the new filename
already exists.

I am using move_uploaded_file().

The fist time an image file is uploaded and moved to a new file name
there is no problem, however if I decide to upload a different image...


Copyright © 2005-08 www.BigResource.com, All rights reserved