1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Help

Discussion in 'HTML, Graphics & Programming' started by triggerthat, 11 May 2006.

  1. triggerthat

    Soldato

    Joined: 26 Aug 2005

    Posts: 6,870

    Location: London

    Hi there,

    Basically I want to create a script for my website that will print out the admin names and passwords. The table is called user under mysql.

    Currently I have something like this however it doesn't work:

    Code:
    <?
    $host = 'localhost';
    $user = 'root';
    $pass = '';
    mysql_connect($host, $user, $pass) or die ('Error');
    @mysql_select_db('mysql');
    
    $query="select users";
    $rt=mysql_query($query);
    echo mysql_error();
    
    while($nt=mysql_fetch_assoc($rt){
    echo "$nt[first_name] $nt[second_name]<br>";
    }
    
    mysql_query($query);
    mysql_close();
    
    ?>
    
     
  2. ArmoVanBuuren

    Hitman

    Joined: 19 Mar 2005

    Posts: 569

    No expert but have you looked at your query, you need to put FROM<tablename> where you are selecting users from.

    Code:
    $query="select * FROM users";
    
     
  3. Augmented

    Soldato

    Joined: 18 Oct 2002

    Posts: 5,464

    Location: London Town

    Note that you won't get the actual passwords from the user table in the mysql DB - they're all one-way encrypted so you'll only get the hash value returned :).