Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-11-2005, 12:09 PM   PM User | #1
theexo51
Regular Coder

 
Join Date: Jul 2005
Location: Guildford, UK
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
theexo51 is an unknown quantity at this point
doing a tutorial - cant see the problem.

can anyone help me with this, i cant see where the problem is....cheers

<html>
<head>
</head>
<body>
<?php

print "<table border="1">\n";
for ($y=1;$y<=12;$y++)
{
print "<tr>\n";
for ($x=1;$x<=12;$x++)
{
print "\t<td>";
print ($x*$y);
print "</td>\n;
}
print "</tr>\n";
}
print "</table>";

?>
</body>
</html>
theexo51 is offline   Reply With Quote
Old 07-11-2005, 12:11 PM   PM User | #2
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,472
Thanks: 4
Thanked 40 Times in 40 Posts
Brandoe85 will become famous soon enough
print "<table border="1">\n";

You cannot use double quotes within double quotes unless you escape them.

print "<table border=\"1\">\n";
__________________
-Brando
Why using tables for eating is stupid!
Brandoe85 is offline   Reply With Quote
Old 07-11-2005, 12:16 PM   PM User | #3
theexo51
Regular Coder

 
Join Date: Jul 2005
Location: Guildford, UK
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
theexo51 is an unknown quantity at this point
ah, i can remember reading that now, so its my book that is wrong! however, now it says the error is on line 17

print "</tr>\n";

:s


EDIT: found it, missed a quote mark.....thanks for the help

Last edited by theexo51; 07-11-2005 at 12:17 PM.. Reason: FOUND IT
theexo51 is offline   Reply With Quote
Old 07-11-2005, 12:36 PM   PM User | #4
theexo51
Regular Coder

 
Join Date: Jul 2005
Location: Guildford, UK
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
theexo51 is an unknown quantity at this point
next problem, i think this book is rubbish, this is copied exactly as printed.

any ideas? error on line 2 apparently

<?php
function addNums($firstnum, $secondnum;
{
$result = $firstnum+$secondnum)
return $result;11: }
print addNums(3,5);

?>
theexo51 is offline   Reply With Quote
Old 07-11-2005, 12:44 PM   PM User | #5
delinear
Regular Coder

 
Join Date: Feb 2005
Location: West Midlands, UK
Posts: 623
Thanks: 0
Thanked 0 Times in 0 Posts
delinear is an unknown quantity at this point
Quote:
Originally Posted by theexo51
<?php
function addNums($firstnum, $secondnum;
{
$result = $firstnum+$secondnum)
return $result;11: }
print addNums(3,5);
?>
Should be :
PHP Code:
<?php
function addNums($firstnum$secondnum)
{
$result $firstnum+$secondnum;
return 
$result;    }
print 
addNums(3,5);
?>
What book is that? It seems pretty messed up
__________________
~ Bazzy
delinear is offline   Reply With Quote
Old 07-11-2005, 12:59 PM   PM User | #6
theexo51
Regular Coder

 
Join Date: Jul 2005
Location: Guildford, UK
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
theexo51 is an unknown quantity at this point
yeah, it is, i might get another, its SAMS teach yourself php in 24 hours...not great but my mate leant it to me and im a cheapskate who wont buy one! lol
most tutorials work but some dont, v. strange
theexo51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:20 AM.


Advertisement
Log in to turn off these ads.