Results 1 to 2 of 2

Thread: php help

  1. #1
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default php help

    Why does this just display the name of the rare rather then the picture

    PHP Code:
    function displayRares($type$limit) {
        
    $raresQuery mysql_query("SELECT * FROM `rares` WHERE type='$type' LIMIT $limit");
        echo 
    "<table border='0'>";
        while (
    $rows mysql_fetch_array($raresQuery)) {
        echo 
    "<tr>";
        echo 
    "<td>";
        if (!empty(
    $rows['url'])) { echo("<img src=\"" $rows['url'] . "\" alt=\"" $rows['name'] . "\".gif />"); }
        echo 
    "</td><td>";
        if  (!empty(
    $rows['name'])) { echo($rows['name']); }
        echo 
    "</td>";
        if (!empty(
    $rows['t'])) { echo("<td>" $rows['t'] . "T</td>"); }
        if (!empty(
    $rows['hc'])) { echo("<td>" $rows['hc'] . "HC</td>"); }
        if (!empty(
    $rows['rd'])) { echo("<td>" $rows['rd'] . "RD</td>"); }
        echo 
    "</tr>";
        }
        echo 
    '</table>';
        } 
    no

  2. #2

    Default

    Well that owuld be because you have put the extention after the alt, so it's not grabbing the image properly..
    PHP Code:
    function displayRares($type$limit) {
        
    $raresQuery mysql_query("SELECT * FROM `rares` WHERE type='$type' LIMIT $limit");
        echo 
    "<table border='0'>";
        while (
    $rows mysql_fetch_array($raresQuery)) {
        echo 
    "<tr>";
        echo 
    "<td>";
        if (!empty(
    $rows['url'])) { echo("<img src=\"" $rows['url'] . ".gif \" alt=\"" $rows['name'] . "\" />"); }
        echo 
    "</td><td>";
        if  (!empty(
    $rows['name'])) { echo($rows['name']); }
        echo 
    "</td>";
        if (!empty(
    $rows['t'])) { echo("<td>" $rows['t'] . "T</td>"); }
        if (!empty(
    $rows['hc'])) { echo("<td>" $rows['hc'] . "HC</td>"); }
        if (!empty(
    $rows['rd'])) { echo("<td>" $rows['rd'] . "RD</td>"); }
        echo 
    "</tr>";
        }
        echo 
    '</table>';
        } 
    Try that..

Posting Permissions

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