473,511 Members | 16,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

print tables by php code

37 New Member
hi, i am trying to get my code to print HTML tables and other html tags but i get error right from the begining when i print a table, where within it there are more tables and then i print my results from queries.


heres the code where it starts from
[PHP]print "<table cellpadding="0" cellspacing="0" border="0" align="center" >"[/PHP]

for some reasons it dont let me, any comments?
Jan 7 '08 #1
4 4437
shane3341436
63 New Member
hi, i am trying to get my code to print HTML tables and other html tags but i get error right from the begining when i print a table, where within it there are more tables and then i print my results from queries.


heres the code where it starts from
[PHP]print "<table cellpadding="0" cellspacing="0" border="0" align="center" >"[/PHP]

for some reasons it dont let me, any comments?
If that is not the type mistake, you cannot use double quote like that
because print command displays the content enclosed within either the pair of double quotes or a pair of single quotes.
You should use
[PHP]print '<table cellpadding="0" cellspacing="0" border="0" align="center" >';[/PHP]
Jan 7 '08 #2
848lu
37 New Member
If that is not the type mistake, you cannot use double quote like that
because print command displays the content enclosed within either the pair of double quotes or a pair of single quotes.
You should use
[PHP]print '<table cellpadding="0" cellspacing="0" border="0" align="center" >';[/PHP]

thanks...it works, i also tried it like this
[PHP]print "<table cellpadding='0' cellspacing='0' border='0' align='center' >";[/PHP]

whats the differene between them?
Jan 7 '08 #3
Markus
6,050 Recognized Expert Expert
Think of quotes as brackets..

eg this is the beggining bracket ( this is the closing bracket )
this is the opening quote " this is the closing quote "

PHP can't tell which quote is closing what so it goes for the first two.

i.e
[php]
$string = "String opened... string closed";
$string = "String opened... quote within string " string closed"; ("
/*the quote within the string will be seen as the closing quote for the opening one.*/
/*however, if we were to use different types of quotes...*/
$string = "string opened... 'quote within string ' string closed";
//the single quote would not close the initial quote
//you can escape quotes with a backslash \
$string "string opened... quote within string \" string closed";
//the quote was escaped and therefore doesnt closer the initial quote
[/php]
Jan 7 '08 #4
spudse
11 New Member
Expand|Select|Wrap|Line Numbers
  1. echo $var; // Results in the value of $var being printed
  2. echo '$var'; // Results in the word '$var'
  3. echo "$var"; // Results in the value of $var being printed
  4.  
Source

With doubles quotes (") you can print things like:
Expand|Select|Wrap|Line Numbers
  1. $name = 'spudse';
  2. echo "My name is $name";
  3.  
With single quotes you need to do this like this:
Expand|Select|Wrap|Line Numbers
  1. $name = 'spudse';
  2. echo 'My name is ' . $name;
  3.  
Also, some special characters, like newlines \n are printed as newline when encapsulated by double quotes and as characters when encapsulated by single quotes.
Jan 7 '08 #5

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

Similar topics

2
15982
by: dan | last post by:
This works in mozilla but I can't figure out why this won't work in IE. Say I have this html <html> header goes here header goes here
14
6094
by: keith edward | last post by:
Hello, I have a long web document... about 30 pages. It is currently in HTML (tables)... how do I format it so that is will print the pages correctly? Thanks, Keith
2
1986
by: Sherwood Botsford | last post by:
I'm new to access. I have an orienteering database that has information about locations all over the map. Each location has 0-N clues I've worked up a report that will print the locations,...
0
1705
by: 5anelli | last post by:
Hi to everyone, I need to create and print (from within a c# application) a MS Word document starting from an Access db. Half of this document must be written and printed in, let's say, January,...
2
9932
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default...
6
9377
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
1
3634
by: chriswilliams | last post by:
This code prints output in rows like this: ****** ****** ****** How to make print in blocks like this? ***** ***** ****** ***** ***** ****** ***** ***** ***** start= int...
12
3510
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
11
7294
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
0
7242
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,...
0
7138
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
7353
Oralloy
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,...
0
7418
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...
1
7075
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
5662
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,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1572
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 ...
0
446
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...

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.