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 3 of 3

Thread: PHP Error

  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    96
    Thanks
    4
    Thanked 0 Times in 0 Posts

    PHP Error

    PHP Code:
    if($ir['user_level'] > 1)
    {
    print 
    "<br />
    "
    <a href='donator.php'>Donate</a> for game benifits"<br />
    ;} 
    Can anyone tell me what is wrong with this?

    It isn't the exact finished bit so don't worry about it being wrong... it saying a few things I don't even understand...

  • #2
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    You have to escape the quotes like so:
    PHP Code:
    <?php
    if($ir['user_level'] > 1

    print 
    "<br /> 
    \"<a href='donator.php'>Donate</a> for game benifits\"<br />"
    ;} 

    ?>

  • #3
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,285
    Thanks
    4
    Thanked 201 Times in 198 Posts
    The way you've got things in quotes is most of the problem.

    PHP Code:
    if($ir['user_level'] > 1)
    {
    print 
    '<br /><a href="donator.php">Donate</a> for game benifits<br />';

    Values for HTML tags have to be enclosed in double quotes not single quotes.

    If you want the entire sentence quoted use:

    PHP Code:
    if($ir['user_level'] > 1)
    {
    print 
    '<br />"<a href="donator.php">Donate</a> for game benifits"<br />';

    Last edited by djm0219; 08-03-2008 at 07:56 PM. Reason: Added 2nd example after seeing previous post
    Dave .... HostMonster for all of your hosting needs


  •  

    Posting Permissions

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