Note that there are some explanatory texts on larger screens.

plurals
  1. POget data from to tables !
    text
    copied!<p>i have user list , and i have select box to filter userlist one of the select box options is show by most viewed so i have also need user information too . i want to sort my users based on most viewed profile in my user list . i have these two tables but i don't know how to right correct query to make this happen . i used grouping like this : </p> <pre><code>$sql ="select userid , count(*) form profile_visit group by userid " ; </code></pre> <p>but it's not make sense to me , i don't think this query will help me at all . </p> <pre><code>+-----------+---------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------+------+-----+-------------------+----------------+ | userid | int(11) | NO | PRI | NULL | auto_increment | | username | varchar(128) | NO | | NULL | | | password | char(40) | NO | | NULL | | | email | varchar(128) | NO | | NULL | | | name | varchar(256) | NO | | NULL | | | lastname | varchar(256) | NO | | NULL | | | job | varchar(256) | NO | | NULL | | | birthdate | varchar(100) | NO | | NULL | | | address | varchar(1024) | NO | | NULL | | | website | varchar(100) | NO | | NULL | | | tel | varchar(100) | NO | | NULL | | | role | tinyint(1) | NO | | 0 | | | reg_date | timestamp | NO | | CURRENT_TIMESTAMP | | +-----------+---------------+------+-----+-------------------+----------------+ </code></pre> <p>and profile_visit table like this </p> <pre><code>+------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | ip_address | varchar(70) | NO | | NULL | | | userid | int(11) | NO | | NULL | | +------------+-------------+------+-----+---------+----------------+ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload