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 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    UK
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    less than, more than tags.

    Hi, i have this:

    PHP Code:
    elseif($row['id'] < 200){

    echo
    '<td><img src=image title="some title"></td>';


    And it works fine however i also have this:
    PHP Code:
    elseif($row['points'] > 1600){

    echo
    '<td><img src="image" title="some title"></td>';


    The problem is, is that on the > tag it only shows 1 image no matter how high the points, the highter the points you have you will have a different image, but it only shows the same 1 all the time.


    PLEASE NOT THE ELSEIF IS MENT TO BE THERE, OTHER IF'S ARE BEFORE THEM!
    http://www.smgames.staticfire.co.uk Under construction, Currently hiring mods and admins anyone interested pm me.

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    is the variable an integer or a string?

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,018
    Thanks
    2
    Thanked 313 Times in 305 Posts
    The posted code is not nearly enough for anyone to help you with why you are getting the same image.

    If you have a series of conditional statements that are supposed to output a different image depending on how large a value is, the only way for anyone to see what the problem might be with the logic or the data, is if you post all the relevant actual code. For all we know, the actual conditional logic is correct, but you are getting the same image because you are using the same image url in all the logic...
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #4
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    use
    PHP Code:
     ($points >1600 &&  $points 2000) {
    echo 
    'between 1600 and 2000';



  •  

    Posting Permissions

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