...

View Full Version : doing a tutorial - cant see the problem.



theexo51
07-11-2005, 01:09 PM
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>

Brandoe85
07-11-2005, 01:11 PM
print "<table border="1">\n";

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

print "<table border=\"1\">\n";

theexo51
07-11-2005, 01:16 PM
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

theexo51
07-11-2005, 01:36 PM
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);

?>

delinear
07-11-2005, 01:44 PM
<?php
function addNums($firstnum, $secondnum;
{
$result = $firstnum+$secondnum)
return $result;11: }
print addNums(3,5);
?>

Should be :

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

What book is that? It seems pretty messed up :o

theexo51
07-11-2005, 01:59 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum