473,413 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

How to upload and download a vcf format file to the database.

i have imported a vcf file to the database but i am not able to export the vcf file. the code that i am using is
Expand|Select|Wrap|Line Numbers
  1. <?
  2.  
  3. $host="xample.com";
  4. $uname="abc";
  5. $pass="abc";
  6. $database = "emp"; 
  7.  
  8. $connection=mysql_connect($host,$uname,$pass); 
  9.  
  10. echo mysql_error();
  11.  
  12. //or die("Database Connection Failed");
  13. $selectdb=mysql_select_db($database) or 
  14. die("Database could not be selected"); 
  15. $result=mysql_select_db($database)
  16. or die("database cannot be selected <br>");
  17.  
  18. // Fetch Record from Database
  19.  
  20. $output = "";
  21. $table = "temp"; // Enter Your Table Name 
  22. $sql = mysql_query("select * from $table");
  23. $columns_total = mysql_num_fields($sql);
  24.  
  25. // Get Records from the table
  26.  
  27. while ($row = mysql_fetch_array($sql)) {
  28. for ($i = 0; $i < $columns_total; $i++) {
  29. $output .='"'.$row["$i"].'",';
  30. }
  31. $output .="\n";
  32. }
  33.  
  34. // Download the file
  35.  
  36. $filename = "myFile.vcf";
  37. header('Content-type: .vcf');
  38. header('Content-Disposition: attachment; filename='.$filename);
  39.  
  40. echo $output;
  41. exit;
  42. ?>
  43.  
can anyone help me??
Jun 25 '14 #1
0 1029

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Matt | last post by:
I want to write a ASP page to open/download a file In fileview.jsp, I have the file browse, and when user click submit button, fileview2.asp should open the file. fileview.asp ============...
2
by: Ryan Taylor | last post by:
Hello. I am trying to upload a file and save it in a Sql Server 2000 database. This seems to be working fine. However, when I download the file from SQL Server, it appears that the page that is...
4
by: MattB | last post by:
Can anyone point me to any good articles or examples of delivering a binary file to the user from a database? I need to pull a PDF file from a SQL Server image field and send it back to the...
1
by: Daniel | last post by:
Hi, can u explain to me what is the path need to use in order to upload and download the file based on below solution: 1.Set up a folder that both the web app and SQL server can get to. 2.Do a...
1
by: theburnetts | last post by:
I am building an ASP.NET application that has a requirement that the user should be able to download all of the data that they have input into the system and save it to a file on their local PC. ...
4
by: abhanjee | last post by:
Hello, I am a newbie and am developing an application for work. I have figured out how to upload a file attachment to the SQL database and download the same file using C# and Visual Studio....
5
by: shantanu | last post by:
Hi i am trying to upload a txt file thru this code, but its not updating the data. is this code fine. Or can anybody please suggest me some other meathod to do the same. its urgent please help ...
1
by: =?Utf-8?B?TGFtaXM=?= | last post by:
HI, I am doing an aspx application and need to let my users be able to edit the information in my database by the page. My first Idea was to let them export the information to an excel file at...
7
by: wolfenstein | last post by:
Hi, I'm searching for this solution from a long time now. i have a https protocol site from a client and i need to upload and download some files from my window service. Now this site also requires...
0
by: angelgal | last post by:
Hi ALL, I have to download a file from web and upload in MS SQLSERVER 2005. However, the problem i am facing is that the file i download in in web page format though it shows excel format. I have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.