Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trouble exporting data using phpmyadmin

Status
Not open for further replies.

tippytarka

Programmer
Jul 19, 2004
115
GB
i'm using a webhost to host my site and a mysql database. the only way to access the database is to use phpmyadmin. but, i'm having some trouble exporting data.

this is what i've been doing...

i run a query to return a particular result.
then click on the 'export' tab
then i select csv for ms excel data
then i select save as file, give it a file name
then press go

and every which way i try it it prints the entire database to the browser??

all i want to do is export a my query as a csv or txt file, or if it persists to print to the browser then print my query to the browser (so i can copy and paste it) and not the entire database.

help!!!
 
I don't use phpmyadmin, but it sounds like the query and export tabs are unrelated.
 
You should do you own function to export information with SELECT statement with a syntax like this:

SELECT a,b,a+b INTO OUTFILE '/tmp/result.text'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM test_table;

Then you can create a CSV file wich is a file separated by commas. It's very easy and usefull and then you get away phpmyadmin. Try it.

===================================
Never underestimate the power of stupid people in big numbers
===================================
 
ok, so if i do this

Code:
SELECT * INTO OUTFILE '/TEST/creat.csv'
FIELDS TERMINATED BY ',' 
ENCLOSED BY ""
LINES TERMINATED BY '\n'
FROM p1_list_creative
WHERE job_title_id = 'CREAT'
AND email != ''
AND telephone !=''
AND city_town = 'london';

why do i get this error

#1045 - Access denied for user: 'dboxxxxxxxxx@%' (Using password: YES)
 
If you read the error has nothing to do with the syntaxis please give your user full access to the database.

===================================
Never underestimate the power of stupid people in big numbers
===================================
 
Here is the link of how to use the SELECT statement that you can read, at the bottom it's a section dedicated to OUTFILES and DUMPFILES


===================================
Never underestimate the power of stupid people in big numbers
===================================
 
bloody 'ell, how am i gonna work this one out?

i'm runnin this sql query within phpmyadmin which is connected to the mysql database, so why am i getting a connection/ denied access error??

i'm feeling quite frustrated now!
 
If you have total control on the server try to give your user fully control on that database

GRANT ALL ON dbname.* TO 'user'@'localhost'

and try to do it via mysqld console.

===================================
Never underestimate the power of stupid people in big numbers
===================================
 
trouble is my database server is via my webhost, and i fret they have security restrictions in place. and, to rub salt in the wounds if i call them, most of their customer reps act like a bunch of w*****s on the phone
 
Tippy,

Does the query your issueing in phpadmin have a where clause ?
 
problem sorted. i was able to export the query using phpmyadmin. the correct export button is located in small type at the bottom of the screen.

i know it still doesn't really solve the problem coz using a gui like phpmyadmin is a bit of a cop out. but it solves the problem for now, i guess.

but cheers, now i'm familiar with the INTO OUTFILE syntax.
 
Tippy,

great you got sorted but can you curb the language please ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top