-1

I need the results of a mysql query to be piped unto a text file so i can print it. Problen is: Where is the text file ?! Here is the php code to run the query:

enter code here
<?php
// Connect to database server
$con=mysqli_connect("localhost","root","root","mydb");
if (mysqli_connect_errno())
    {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
$sql1 = "SELECT startDate,endDate,intervalTime FROM june2013
INTO OUTFILE 'xxx.txt'";
if (mysqli_query($con,$sql1))
    {
     echo "Data added to text file successfully";
    }
else
   {
    echo "Error transfering data " . mysqli_error($con);
    }
  mysqli_close($con);
?>

After I had ran the above code I recieved the message:

Data added to text file successfully

Which means the code succeeded in creating the desired text file. I searched the file in my HD at: xampp/htdocs and couldn't find it ! Then I made a WINDOWS 7 search for "xxx.txt" and the search found nothing ! So I ran again the code and recieved an error message that says:

Error transfering data File 'xxx.txt' already exists

If that file exixts, where could it exist if not on my hard disk? If it is on my hard disk why can't I find it? Could it be some kind of a "hidden file? Can anyone help me with that? Thanks

deotpit
  • 95
  • 1
  • 3
  • 12

1 Answers1

0

This might help: MySQL select into outfile /tmp no output

Community
  • 1
  • 1
Paddyd
  • 1,870
  • 16
  • 26