Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:33:24+00:00 2026-06-16T09:33:24+00:00

Following is my sql query which worked fine when i ran it from phpmyadmin

  • 0

Following is my sql query which worked fine when i ran it from phpmyadmin but when i ran the same query through PHP then the query didnot worked and gave me following error. Kindly let me know how can I run this query from my php file so it will create the output file in the specified folder. Thanks,

QUERY

SELECT * FROM lahore_student INTO OUTFILE 'b://uploaded//data.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '".'"'."'
LINES TERMINATED BY '\n'

Output: It creates file to my b drive in FOLDER named as Uploaded

ERROR:
File ‘b:uploadeddata.csv’ already exists

NOTE: The uploaded folder was empty

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:33:25+00:00Added an answer on June 16, 2026 at 9:33 am

    It looks you are trying to run this on a windows system, which requires special treatment of directory separators.

    Try:

    SELECT * FROM lahore_student INTO OUTFILE 'b:\\uploaded\\data.csv'
    FIELDS TERMINATED BY ','
    ENCLOSED BY '".'"'."'
    LINES TERMINATED BY '\n'
    

    Or:

    SELECT * FROM lahore_student INTO OUTFILE 'b:/uploaded/data.csv'
    FIELDS TERMINATED BY ','
    ENCLOSED BY '".'"'."'
    LINES TERMINATED BY '\n'
    

    Also note that this will not overwrite an existing file (which is the error you are getting). So you need to make sure that any file with that name is deleted first.

    See the The “\” path name separator character section on this page in the MYSQL docs:
    http://dev.mysql.com/doc/refman/5.0/en/limits-windows.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following which works in SQL Query Analyzer . select oh.* from
I have the following SQL query which I use to fetch some rows from
Hello i've the following SQL Query which produces the following result SELECT * FROM
I have following example of the PHP/SQL which worked perfectly when editing one row
I have following somewhat complex sql query which has horrible performance, 'certainly' due to
I have a drop-down list which is generated based on the following sql query:
If I run the following SQL query SELECT * FROM A LEFT JOIN B
i have the following sql query select * from tblArea where AreaDescription in ('Processing1','Geology
I have a var dump of my sql query which return the following I
i have the following SQL Query which runs on SQL Server CE 4 SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.