word document should display the details about the candidate. -
<?php
-
include("config.php");
-
-
//$table = 'table_name';
-
$outstr = NULL;
-
-
$id = $_GET['id'] ;
-
-
header("Content-Type: application/msword");
-
header("Content-Disposition: attachment;Filename=candidate.msword");
-
-
/*$conn = mysql_connect("localhost", "mysql_user", "mysql_password");
-
mysql_select_db("db",$conn);*/
-
-
// Query database to get column names
-
$result = mysql_query(" select * from candidate where cid='$id'");
-
// Write column names
-
while($row = mysql_fetch_array($result)){
-
$outstr.= $row['cid'].',';
-
}
-
$outstr = substr($outstr, 0, -1)."\n";
-
-
// Query database to get data
-
$result = mysql_query("select * from candidate where cid='$id'");
-
// Write data rows
-
while ($row = mysql_fetch_assoc($result)) {
-
$outstr.= join(',', $row)."\n";
-
}
-
-
echo $outstr;
-
-
?>
-
a blank word doc is created...
if i change this code, -
$result = mysql_query(" select * from candidate where cid='$id'");
-
as like this, -
$result = mysql_query(" select * from candidate");
-
it works fine...
but i want to display only a particular candidate's details... not all the candidate...
how to do it? plz help.
i tried in pdf, i m also having same problem in that select query...
4 2037 JKing 1,206
Recognized Expert Top Contributor
Use echo "Error: " . mysql_error(); after your query to get a better idea of what is going wrong. Is cid numeric or string?
If I understand...
Are you get not make a efficient instruction on SQL, isn't?
Where you put the character '*', you should put the fields of the tables in your database.
Example:
If I have a table:
people(id, name, age, address);
And here a simple select:
SELECT name FROM people WHERE id = 2;
with that I'll get a name of the people where your ID equal two.
CYA!
-
$result = mysql_query(" select * from candidate where cid='12'");
-
if i give like this it works. but what's the problem is,
there are several candidates in the table. i want to create each candidate's details as a word doc.
for example,
candidate table consists of several fields like cid,cname,maili d, phone,etc....
my candidate's list is like,
cid cname
14 xxxx
15 yyyy
16 bbbb
17 zzzz znd so on.
when i click the 'yyyy' it will retrieve all the info about 'yyyy' in a separate page(candidated etails.php)... from this page (candidatedetai ls.php) i want to create a word doc that contains all the info about 'yyyy'.
i am passing cid from candidatedetail s.php to createdoc.php.. .
thank you!
code green 1,726
Recognized Expert Top Contributor
This is exactly the same problem as your other post. http://bytes.com/topic/php/answers/9...iles-using-php
You are ignoring advice on how to debug your problem from me and JKing,
instead preferring to repeat the same question.
We can't help you if don't help yourself!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Francis Dion |
last post by:
You might want to investigate XpertDoc. It creates genuine MS-Word
documents without making any call to the MS-Word application, making
it more reliable, much faster and easier to deploy and support.
You can check it out at www.xpertdoc.com.
From: Rudy Ko (rko@lucent.com)
Subject: Create word document
View: Complete Thread (4 articles)
|
by: unotin |
last post by:
I have an application in ASP that exports to Word using the
Response.ContentType method.
The application references another ASP page through the img tag that uses a
Response.BinaryWrite (of an img content type) for its output.
In other words:
App A.ASP contains the code: <%Response.ContentType =
"application/vnd-msword"%> <img src="B.ASP">
|
by: Sérgio Almeida |
last post by:
Greetings
it is possible to create Word documents using C#? If so, where can I
find examples/help for this?
Thank you very much
Sérgio
|
by: Johann |
last post by:
Hi,
anyone could help me with finding info on how to create Word documents on
the fly with ASP.NET ?
I need, from an existing template, to generate a new file with data filled
in the word document.
Thanks for your precious help
|
by: hullyi |
last post by:
how can I generate a Word document on the fly with c# tools only or by javascrip
| |
by: Mills |
last post by:
Hi,
I am currently trying to automate word using c#, I have created a
..dot file and have placed a bookmark in the middle of the document, I
am trying to create a variable number of tables from this point, but
what happens is the tables get nested within each other, I want it
like the following:
Table 1
<CRLF>
Table 2
|
by: Francis Dion |
last post by:
You might want to investigate XpertDoc. It creates genuine MS-Word
documents without making any call to the MS-Word application, making
it more reliable, much faster and easier to deploy and support.
You can check it out at www.xpertdoc.com.
Message 1 in thread
From: Jeff Kennedy (jkennedy@hotboxhosting.com)
|
by: Johann |
last post by:
Hi,
anyone could help me with finding info on how to create Word documents on
the fly with ASP.NET ?
I need, from an existing template, to generate a new file with data filled
in the word document.
Thanks for your precious help
|
by: ads |
last post by:
hi
i was given a task to display sql server data in ms word using xml. Im
currently doing research to accomplish the task. What i have in mind is to
create an xml template (or schema?) to load the sql server data first.Then
add the xml template in the ms word add-in option. Is it possible? Can anyone
point me to the right direction?
Thanks
|
by: sajil |
last post by:
hai
i have a problem i have done a program in visual basic 6 where i connected to word but i am not able to create a table in word if possible please tell me and can we move the table in the word using vb please let me know
sajil
|
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...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |