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




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:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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???

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 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 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 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.

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 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 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 Table
Hi,

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

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 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?

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 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.

Loading Mysql Database From File
Maybe it's not a proper place to ask this question, but maybe someone
could provide me the way to load file with schema and data of mysql
database (created by phpMyAdmin on Windows system), to create a new
database on linux system.

Image File In MySQL Database
I want to be able to save an image file in MySQL database. I realized there are a number of threads on this particular issue. However, the way I am planning to implement it is to have the image save in the MySQL database instead of a link (Blob?)

Name Of File That Stores MySQL Database Data
I need to recover my database from a backup after a system crash. What is the file name (extension) that stores the database information?

Restore MySQL Database Backup File Through PHP?
I wrote a PHP script to backup my complete database and send it through email. When I import the file through PHPMyAdmin, everything works. However, when I try to restore the database through PHP (I found similar code on several sites), it doesn't do anything:

$restore = "mysqlimport -u $dbuser -p $dbpass $dbname $location";
$importFile = system($restore, $return);

This is what $restore contains: mysqlimport -u user12345 -p pass12345 database12345 tempdata/backuprestore/mp_database_15-09-2007.sql

I also tried shell_exec instead of system aswell, but this didn't work either. Does anyone know how I can do this with PHP? I need this for my admin panel.

PS: mysqlimport is used to import data into a already existing database, right? Since that's what I need.

Automated File Upload To Mysql Database
I am looking to develop an application that provides decision support
through various graphs and charts using a mysql backend. My problem is
between the data collection and data represenation. I would have a
handheld device with a database application on it to collect data, this
data (in a csv file most probably) would be transferred wirelessly to a
pc, which then would need to be uploaded online and loaded into the
correct mysql table so that any graphs would update their
representation of the data.

I am pretty new to this stuff so please bear with me but I guess the
first step would be to have a script to detect the creation or
modification of a file by the name xxx. However what would happen next?

How would the file be uploaded online and how would it be automatically
loaded into a particular mysql table?

Easiest Way To Upload A File To A MySql Database
I want my clients to load up a file to a MySql database. The file should
contain rows with

name, email, address, city

What would be the easiest way (in terms of the big picture), to get them to
upload it and put it in a mysql database?

Just let me know if you have any hints on how to go about this? (should
they use excel, or a text file, do you reject the whole file if there is an
error, etc... etc....)

Import Excel File Into MySQL Database
I am relatively new in this field, and one of my first challenge is the following :

Importing an Excel file, containings URL, into a MySQL database.

It must be the simplest process possible for the end user, avoiding as far as
possible all steps of converting and/or transforming files.
Of course, we want to preserve the identity of the URL.

Import Excel File To Mysql Database
i want to import excel file into mysql database .

Importing Excel File Into Mysql Database
I need help regarding importing excel file into mysql database.I am using PHP 5.0.2, mysql 4.2.13. I need code for importing excel file into mysql database and what will be the steps for it.

Uploading Info From A Text File Into A MySQL Database
what would the PHP and SQL code be to say basically: make a new row and put this in the field, what comes after each comma goes in a new field, and each new line should be a new row.

I have a huge text file that i don't have a way to upload directly into a MySQL database because my webhost isn't allowing it for some reason.

Flash Embeded In PHP File Accessing Mysql Database....HELP
this is my code and what i get... i'm accessing this through this url

http://192.168.0.2/php/test2/test.p...ca&subject=test

it grabs the correct stuff from the database, but doesn't put it into
flash.

this is what i have in the flash file...

onClipEvent (load) {
// assuming you have a personal web server and PHP installed
locally
loadVariables("http://192.168.0.2/php/test2/test.php", this,
"GET");
}

named the textboxes, accordingly, 'name', 'email', and 'content'

and the php....

<html>
<head><title>Flash Test</title></head>
<body>

<br><br>

<?php

//phpinfo();

error_reporting(E_ALL);

$user = $HTTP_GET_VARS['user'];
$subject = $HTTP_GET_VARS['subject'];

$link = mysql_connect('localhost', 'mailer', 'mailer321')
or die('Could not connect: ' . mysql_error());

mysql_select_db('mailer') or die('Could not select database');

$query = "SELECT * FROM email where name = '$user' and subject =
'$subject' order by id desc limit 1";
$result = mysql_query($query) or die('Query failed: ' .
mysql_error());

while ($rows = mysql_fetch_array($result)) {

$name = $rows['name'];
$email = $rows['subject'];
$content = $rows['content'];

}

Storing BINARY File Uploads Into A Mysql Database
I know I do a column with a BLOB of size of the max file size I guess...
then I tell php to do: fopen($FILE,'rb'); fread($file,1024); (loop) then I send the info to the db???

How would I download the file later then, would I have to write it to a fiel first? or could I ouptu it to the browser if I supply , content-type: binary?

How To Retrieve An Xml File From An Xml Field Found In Mysql Database?
Infact i have a mysql database in which i have field name xml in which all the metadata are stored in xml files.

What Is Indexing In Mysql And How It Will Be Useful And How We Can Retrieve Database Content Easily From A Database Table Containing About 5lakhs Datas
I need to select data from a database table containing huge amount of
data. Now I am storing data using one primary key and I am just using
simple select statement, and this process gives me the output but it is
taking long to execute the query. As much I had heared I want to use
some indexing or cluster indexing which might help me but I am not so
familiar with these things.

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:

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)?

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 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 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 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:

Copy And Paste On MySQL To MySQL Database
Would there be any issues if i literary Copy and Paste a mysql db from one server to another mysql db server? When i say "copy and paste" is just like tranferring one word doc from one pc to another pc.

I tried the copy and paste already and the new server had recognize the DB i had pasted. I just want to confirm if there would be issues doing it so.. Or should i use Mysql.com Migration toolkit?

Php/Mysql- Uploading Mysql Database
I've set up a basic database using Mysql (just creating a web blog I followed a tutorial) and then started writing the php code for interacting with the database. how do I put the Mysql database onto the the web server where I have server space (the server I use is just some company that I pay €100 a year for). I need the php file to get the data from the Mysql database...

Using Css Out Of The Database And Not A Css File?
My website is template based, and all of the templates contents are stored in a database. Well my css code is stored in a template, which is in the database. Currently I am just echoing out the content by using a variable like $global_css. Well the downside to this is that I have to put all of the CSS in <style> tags, so it doesnt get cached. So inorder to cache the CSS I need to use a link tag instead of <style></style> tags. So the only way to use the link tag is to link to a css file. Well since all of my CSS is stored in the database I figured I would just echo out my css in a php file and then just link to that, but I have been unsuccessful. Basically my question is, why doesn't this work?

<link rel="stylesheet" type="text/css" href="echocss.php" media="all" />

When you go to echocss.php its the same exact thing as going to a css file. It has all of the css information in it. I even tried changing the type and it didnt work either:

<link rel="stylesheet" type="application/x-httpd-php" href="echocss.php" media="all" />

Does it have to be a .css file? Any ideas how I can do this using a php file?

File Or Database
I have developped a system that delivers some newsletters in either of these forms (text, html or pdf). I currently store a link to these files in my database and deliver newsletters from their physical address in my mailer function. These are under 32K and I will store under 100 objects (text, pdf and html) .

What will you do?

1- Store them in Database? (will this imrove the speed very much if I am going to post about 1000 copies each week?)

2- Store text and html in database but pdf file in file form (with a link to physical file address nd then deliver it from file?

3- Store all of them in file format?

Database Row To Text File
I need to get the contents of a MySQL database field into a text file, and write the file to the server. I can not seem to get any filesystem functions to work, because it tells me I do not have permission to do anything. I am on virtual hosting, so it seems easier for me to try to FTP files to my own server.

Perhaps you guys can give me some pointers, this is kind of the idea I am running on:

Database Or File For Name Generator ?
I am making a random name generator, it will pick two or three words
from a list and turn them into a name. It seems a database needs to
work with name/value pairs, so am I right in thinking for a simple
list, seperated by line breaks, a file is the most sensible choice ?
If so, what happens if someone else tries to write to the file whilst
I am working with it ?

Text File Instead Of Database?
Does anyone know a script that I can use to manage members of my website (preferably with a control panel-type interface) but without using a database? I read on hotscripts.com of one that uses text files instead, but the link says that the site is no longer offering that file.

If someone could help me it would be great, as I know nothing about scripting. By control panel, I mean a page that I can go to on my site (not open to the public) that I can use to Admin the users. I would like it to go something like this: (this is what was offered at hotscripts.com)

New Members Username:
New Members Password:
New Members Name:
New Members E-Mail Address:

And optionally (I don't really need it, but if its possible, hey why not) a place for me to put in an admin username and pass to get into the page mentioned above. I would also like to be able to implement this script on my main page (see here for what I mean.

Database Of File Types
i'm trying to build a database which holds the urls and info on files in one table and the possible file types (html code used to embed the files) in the other table, this includes gif, jpg, swf and dcr.

now i make a select from the file table and determine what file type it is and then depending on that i select the file type in the other table that i will need to display it on the page. all the selects work fine but i'm not sure how to store my file type in the database, i have it stored as "text" in a mysql table and the html is like so...

<img src='$work_url' width='$work_width' height='$work_height' border=&#390;' />

where all the variables are the details of the file that have already been alocated! i know its something small i'm getting wrong like using '$work_url' or something like that but i've tried different combinations so far and no luck!

Efficiency Of File Vs Database
I have a program that reads the contents of a file (1 line, 5 '|'
seperated items). Every so often (between twice a day, and 200 times a
day), it rewrites the contents of that file. I also do a few database
update queries whenever the file is written. I only open up the
database connector if I need to update the database. The script itself
runs every 30 seconds. My question, is that is it faster and more
efficient to read the file every time, or open the database connector
and make a query? The file name never changes, and I read the whole
file at one time (679 bites).

Flat File Database
I'm making a flat file database script right now and I need to know if there's a certain limit of characters that can be reached so that the information is written onto the next line.

For example if I had this text file:

hello hello hello hello hello hello hello hello hello hello

If I kept writing "hello", is there a certain limit where hello will go to the next line? Because I'm storing each set of information on it's own line, I don't want one of them to become too long and go onto the next line and mess up the database.


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