Jump to content

Sam1

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Sam1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sam1

    top 10 users

    thank you for your help *** like this? $qry = "SELECT *, COUNT(userid) as `cnt` FROM table1, table2 WHERE userid = id GROUP BY userid ORDER BY cnt DESC LIMIT 0,10";"; $result = mysql_query($qry) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo $row["userid"]; echo $row["cnt"]; } mysql_free_result($result); and how can i make the result into 2 columns , because now it like this 3333225614848152238156134101321073301129436232119 thank you
  2. Sam1

    top 10 users

    JAY6390 I tried $qry = "SELECT *, COUNT(userid) as `cnt` FROM table1, table2 WHERE userid = id GROUP BY userid ORDER BY cnt DESC"; $result = mysql_query($qry) or die(mysql_error()); echo $result; and it prints "Resource id #68 " !!! what is my mistake?
  3. Sam1

    top 10 users

    I tried get_result ("select DISTINCT(`table2`.`username`) AS `username`, COUNT(`table1`,`userid`) AS `postcount` FROM `table2` LEFT JOIN `table1` ON `table1`.`userid` = `table2`.`userid` GROUP BY `table2`.`userid` ORDER BY `postcount` DESC LIMIT 0,10"); echo $query; did not work Warning: mysql_fetch_assoc() expects parameter 1 to be resource
  4. Sam1

    top 10 users

    WOW...you guys are amazing....thank you so much I'm Beginner so please Be patient with me how to print(echo) query result? $qry = "select DISTINCT(`table2`.`username`) AS `username`, COUNT(`table1`,`userid`) AS `postcount` FROM `table2` LEFT JOIN `table1` ON `table1`.`userid` = `table2`.`userid` GROUP BY `table2`.`userid` ORDER BY `postcount` DESC LIMIT 0,10";
  5. Hello I want to learn how to make a script, that reads 2 tabels to find and print top 10 users Table1: postname - userid Tabel2: username - id ( userid = id ) the script needs to count and print top 10 users with most posts #1 userA 1000 Posts #2 userB 900 Posts Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.