php - how mySql Data store in unique excel file that should be created dynamically -


i have web page in user given input methods fetch data database. data displayed on web page.

i want store data user fetched data s-q-l database excel file. command i'm using given below

$excelquery1="select * excel12  outfile 'd:/downloads/xyz.csv'";  $excelresult1=mysql_query($excelquery1); 

it running ok , data being fetched stored in new file created in downloads folder name xyz.csv

but user have go manually location check file.

how possible user must shown downloaded file in download bar. + want ask if xyz.csv present in location when query execute in scenario query won't execute saying file present. how tackle problem ?

how give unique file name file created..

this main idea. need adequate code need

$file="/path/to/file".date("ymdhis").".csv"; //file location header('content-type: application/octet-stream'); header('content-disposition: attachment; filename="'.basename($file).'"'); header('content-length: ' . filesize($file)); readfile($file); 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -