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

Thread: Select from DB

  1. #1
    Banned
    Join Date
    Feb 2008
    Location
    USA
    Posts
    61
    Thanks
    15
    Thanked 1 Time in 1 Post

    Select from DB

    I don't know how to make it select from the database and then whatever number it is it gets the image. I have

    PHP Code:
    <?php require_once("config.php"); ?>
      <?php $result mysql_query("SELECT * FROM qls3_users WHERE username = '$reputation'")
      or die(
    mysql_error()); ?>
      
      <?php

    if ($reputation != 10) {

    echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\ />";
      
      }
      
    $reputation $retreive_from_database;
      if(
    $reputation 11) {
      
      echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />";
      
      }
      
    $reputation $retreive_from_database;
      if(
    $reputation 12) {
      
      echo 
    "<img src=\"images/buttons/reputation/prep1.jpg\" alt=\"This user is average.\" width=\"8\" height=\"10\" />";
      }
      
      
    $reputation $retreive_from_database;
      if(
    $reputation 13) {
      
      echo 
    "<img src=\"images/buttons/reputation/+positive rep2.PNG\" alt=\"This user is average.\" width=\"10\" height=\"10\" />";
      }

    ?>
    But all that does is keeps that image. If I change the database (In phpmyadmin) in default I will put 13 as in the editor it shows "if ($reputation != 10) { " And keeps that same image EVEN when I put 13 as the default.

    So can anyone tell me what to use to make this work properly?

    Thanks

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You really mean to select WHERE username = $reputation?


  •  

    Posting Permissions

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