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
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts

    error in else statment

    hey i dont belive i finished the code off properly because all i get for an image is
    http://www.runningprofiles.com/membe...3E%20%20%20%20 ... ect ect
    Code:

    PHP Code:
    <?php 

    $q 
    mysql_query($sql) or die("Error running query:".mysql_error());

    if(
    $row mysql_fetch_array($q))
    {
        echo 
    "<img src='http://www.runningprofiles.com/members/images/thumbs/"$pid "." $row['ext']  . "'";
    }
    else
    {
        echo 
    "<img src='http://www.runningprofiles.com/members/images/noimage.jpg";}

    ?>

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Where is the closing forward slash and &gt; for those image tags?

    Code:
    <img src="some/path/pic.pic" />

  • #3
    Banned
    Join Date
    Feb 2008
    Location
    Winnipeg, Canada
    Posts
    396
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You need to close your image tags, and if you're using XHTML standards throw in a slash and an alt attribute as well

    PHP Code:
    <?php 

    $q 
    mysql_query($sql) or die("Error running query:".mysql_error());

    if(
    $row mysql_fetch_array($q))
    {
        echo 
    "<img src='http://www.runningprofiles.com/members/images/thumbs/"$pid "." $row['ext']  . "' alt='' />";
    }
    else
    {
        echo 
    "<img src='http://www.runningprofiles.com/members/images/noimage.jpg' alt='' />";}

    ?>


  •  

    Posting Permissions

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