Announcement

Collapse
No announcement yet.

Trying to print all usernames and userids.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to print all usernames and userids.

    I am having a bit of trouble with a section of my script. What I trying to do is to print all userids and usernames for all members that are in the forums. I am not too keen with the PHP. I know it's something that I am doing wrong.

    This is what I am simply trying to print..

    userid=1 username=user1
    userid=2 username=user2
    userid=3 username=user3
    userid=4 username=user4
    userid=5 username=user5

    This is the code:
    PHP Code:
    require("./global.php");
    $users $DB_site->query("SELECT user.userid, user.username FROM user WHERE user.userid = user.userid");
    while(
    $userlist $DB_site->fetch_array($users)) {
    echo 
    "userid=$userid  username=$username<br>";    


  • #2
    PHP Code:
    require("./global.php");

    $users=$DB_site->query("SELECT userid,username FROM user");
    while(
    $userlist=$DB_site->fetch_array($users)) {
      echo 
    "userid=$userlist[userid]  username=$userlist[username]<br>";

    That's what you need. Can you understand what was wrong with your code, or do I need to explain it?
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      Thanks that's it!

      Yes, it would be nice for you to explain. Knowledge is power!

      Comment


      • #4
        I hope this can wait for tomorrow, I'm really *yawn* tired right now, and the answer would probably be better tomorrow.
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment


        • #5
          fine with me.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X