php - Get the locations of selected user -
here query,
$query=mysql_query("select * quiz_grades grade, user_info_data info, user user user.id=grade.userid , user.id=info.userid , grade.quiz=12 , info.fieldid=1 , info.data='ap' order data asc, grade desc");
from following table,
$user->id
current logged in user variable.
if userid
=$user->id
belongings ap, ap should display. if userid
=$user->id
belongings tl, tl should display.
info.data
storing ap , tl records.
<table> <tr> <th>userid</th> <th>data</th> </tr> <tr> <td>1</td> <td>ap</td> </tr> <tr> <td>2</td> <td>tl</td> </tr> <tr> <td>3</td> <td>ap</td> </tr> <tr> <td>4</td> <td>ap</td> </tr> <tr> <td>5</td> <td>tl</td> </tr> <tr> <td>6</td> <td>tl</td> </tr> <tr> <td>7</td> <td>ap</td> </tr> <tr> <td>8</td> <td>tl</td> </tr> <tr> <td>9</td> <td>tl</td> </tr> <tr> <td>10</td> <td>tl</td> </tr> </table>
thanks in advance
you should include condition in query below, considering have location field in user
table
select grade.* quiz_grades grade join user user on user.id=grade.userid , grade.quiz=12 join user_info_data info on user.id=info.userid `fieldid`=1 , info.data = 'telengana' order data asc, grade desc
Comments
Post a Comment