Results 1 to 2 of 2

Thread: [RESOLVED] problem displaying color in my database output

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Resolved [RESOLVED] problem displaying color in my database output

    Hi all i want to use the value of color from database in coloring the name value but i do not know how to do it. could any one show me how i can achive this task.Thanks

    i tried this and gives me syntax erro

    echo("<tr><td><font color="#FF00FF">$Name</font></td>

    furthermore i want to replace #FF00FF with value color from db.


    PHP Code:
    <?
        require("util.php");
        $sql = new MySQL_class;
        $sql->Create("color");


        
        #
        # Selecting Multiple Rows
        #

    echo("<html>");
    echo("<head>");
            echo("<p><ul><table border=1 cellpadding=4>\n");
        echo("<tr><th>Name</th> > <th> color </th> </tr>\n");
        $sql->Query("Select  Name,color from NameColor");
        for ($i = 0; $i < $sql->rows; $i++) {
            $sql->Fetch($i);
            $Name = $sql->data[0];
            $color = $sql->data[1];
          
           
          
           

            echo("<tr><td>$Name</td> <td>$color</td> \n");
            #echo("<tr><td><font color="#FF00FF">$Name</font></td> <td>$color</td>  \n"); ==> error here

           
        }
        echo("</table>\n");
        echo("</body>");
        echo("</html>");
      
    ?>

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: problem displaying color in my database output

    echo("<tr><td><font color=\"$color\">$Name</font></td>");

Posting Permissions

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



Click Here to Expand Forum to Full Width