473,801 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in reading a file from database

99 New Member
Hi guys, i have a php file to read to content, the following is the code
[PHP]
<?php
include "config.inc.php ";
include "connect.inc.ph p";

if(isset($_GET['id']))
{
$id = $_GET['id'];
$query = "SELECT filename, filetype, filesize, content FROM candidate_table where id = '$id'";
$result = mysql_query($qu ery) or die(mysql_error ());

list($filename, $type, $size, $content) = mysql_fetch_arr ay($result);
$file = fopen($filename ,"r") or exit("unable to open");
echo "<div style=\"border: 1px blue solid; \">";
while(!feof($fi le))
{
echo fgets($file);
}
fclose($file);
echo "</div>";
/*
header("Content-length:$size");
header("Content-type:$type");
header("Content-Disposition:att achment; $filename=$name ");
echo $content;*/
exit;
}

?>
[/PHP]
but, when run the scripts, it showing the following error,

[HTML]
Warning: fopen(drgulrez[02,00][2].doc) [function.fopen]: failed to open stream: No such file or directory in C:\wamp\www\dr_ resume_databse\ cv.php on line 12
unable to open
[/HTML]
i m not able to fine the solution, if any one can help, plz help me thanks
Nov 23 '07 #1
4 1424
coffear
20 New Member
presumably drgulrez[02,00][2].doc is actually a file? Also it might be best using a server path to the file in fopen as well.
Nov 23 '07 #2
robin1983
99 New Member
Yes, this is the file, when i run other php file to download the same file its working properly, but when i try to open the same file its giving the warning that i posted earlier. and how to used server path...i dont have idea for that plz help...

presumably drgulrez[02,00][2].doc is actually a file? Also it might be best using a server path to the file in fopen as well.
Nov 23 '07 #3
assimlation
9 New Member
on the line after your list() function call you could manip your filename variable to have the path included.. ie:

$filename = "C:\wamp\www\dr _resume_databse \" . $filename;
Nov 23 '07 #4
robin1983
99 New Member
Thanks.. for the reply.. . i got the solution.. and thanks for guiding me ...
on the line after your list() function call you could manip your filename variable to have the path included.. ie:

$filename = "C:\wamp\www\dr _resume_databse \" . $filename;
Nov 24 '07 #5

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

Similar topics

4
2427
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data and images offline and then send them online... but i have a problem regarding the images i want it to be sent to the web site So i want if there is a possible way to fill data offline and
7
12662
by: Graham Taylor | last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it here also, as I think it might be the webserver which is causing my problem. --------- I have an Access 2003 database which is in the "fpdb" folder of my webserver. Its located there so that I can use asp to build a web-based front-end for users to read the database - http://www.nist.ac.th/maths/test1.asp The MBD file is edited using Access (2003) and opening...
3
584
by: David Blasdell | last post by:
This appears very strange to me, I'm having a problem with a fstream object inside a class which is not being called directly from main (another class calls the class that contains the fstream object). Use the following code (stripped down from what I'm actually working on, but does has the problem I'm experiencing) Create a file called test.txt in the working directory with a few bytes of any text or data Can you explain to me why...
2
2497
by: Sabin Finateanu | last post by:
Hi I'm having problem reading a file from my program and I think it's from a procedure I'm using but I don't see where I'm going wrong. Here is the code: public bool AllowUsage() { OperatingSystem os = Environment.OSVersion; AppDomain ad = Thread.GetDomain();
7
2922
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the database into classes, which are used throughout the application. I have made class collections which, upon reading from the DB, create an instance of the class and store the DB values in there temporarily. My problem is that if user1 looks at...
1
1260
by: needin4mation | last post by:
Hi, I am uploading a file and changing a record in a database. When the database is updated, I retrieve the last_insert_id() to get the latest row key. I also have a Page_Load event that populates controls on the form. The Page_Load gets the information from the database, including the field that has the latest key from my database (say product id). The problem is that my upload event is slower than the Page_Load event
10
1543
by: tvin | last post by:
Hi all I brought a string from a .txt file which was saved like utf-8. In the .txt file i have this string "frédéric".My problem is that when i read this file .txt,the bytes of é are like this : 101,180. é length are 2 in utf-8 file.how can i change this 2 length to 1. my problem that i want to use é like 233 byte and not like 2 bytes 101,180
9
5763
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just call it Express for simplicity). I have, to try to simplify things, put the exact same DB on two systems, one running MSDE and one running Express. Both have 2 Ghz processors (one Intel, one AMD), both have a decent amount of RAM (Intel system...
0
1716
by: nrip | last post by:
Dear All, I am facing a very peculiar problem. I am reading a CSV file from my JSP code and trying to insert them into MYSQL database. the program first reads a line and then splits it into words using the split function and then inserts them into different fields of the database. But the problem is that the JSP ; token=line.split(" "); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
2
2846
by: Derik | last post by:
I've got a XML file I read using a file_get_contents and turn into a simpleXML node every time index.php loads. I suspect this is causing a noticeable lag in my page-execution time. (Or the wireless where I'm working could just be ungodly slow-- which it is.) Is reading a file much more resource/processor intensive than, say, including a .php file? What about the act of creating a simpleXML object? What about the act of checking the...
0
9697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9555
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10291
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10049
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9100
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7589
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2956
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.