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

Thread: Images and php

  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Images and php

    Hello there,
    I am working on customizing this php script, and I want to add an image to the code. The code is this:
    <?
    if ($page > 0) {
    echo "<a href=\"index.php3?page=" . ($page - 1) . "\"><img src="next.png" width="25" height="9"> </a>;
    }
    else {
    echo "Next $aantal_per_page messages | ";
    }
    $bla = 10 + 10 * $page;
    if ($num > $bla) {
    echo "<a href=\"index.php3?page=" . ($page + 1) . "\">Past $aantal_per_page messages</a>";
    }
    else {
    echo "Past $aantal_per_page messages";
    }
    ?>
    The code in bold is my problem, when I go and check to see if it works I get this error:

    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /mnt/host-users/m3e/Php-Bin/test/index.php3 on line 28

    Can anyone help me out??

  • #2
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone? Please I really want to finish this today, someone help me plz!!!!

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Double quotes within double-qouted string variables must be escaped with a backslash. See also

    http://se.php.net/manual/en/language.types.string.php

  • #4
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you mean something like this:

    <?
    if ($page > 0) {
    echo "<a href=\"index.php3?page=" . ($page - 1) . "\"><img src=\"next.png" width="25" height="9"> </a>;
    }
    else {
    echo "Next $aantal_per_page messages | ";
    }
    ???

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No, that's not what I meant. Have you read the page I posted? Everything is explained there in great detail.
    You need to escape the other backslashes that appear in the string as well.

  • #6
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok I got it Thx


  •  

    Posting Permissions

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