Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Location
    Guildford, UK
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    print "<table border="1">\n";

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

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

  • #3
    Regular Coder
    Join Date
    Jul 2005
    Location
    Guildford, UK
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 01:17 PM. Reason: FOUND IT

  • #4
    Regular Coder
    Join Date
    Jul 2005
    Location
    Guildford, UK
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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);

    ?>

  • #5
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    Regular Coder
    Join Date
    Jul 2005
    Location
    Guildford, UK
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •