Jump to content
php.lv forumi

select 2 query


FT3

Recommended Posts

Sveiki , ir radusies šada problēma.

 

Query izvada lietotāju nick , un pec id izvada balvas id , bet tada problēma ka izvada tikai 1 balvas id , bet balvas ir vairakas

 

<?php
include('inc/connect.php');
$rpp = '23';
$adjacents = 4;
$page = intval($_GET["page"]);
if($page<=0) $page = 1;
$reload = $_SERVER['PHP_SELF'];

$sql = "SELECT * FROM `members` ORDER BY `member_id`";
$result = mysql_query($sql);
$tcount = mysql_num_rows($result);
$tpages = ($tcount) ? ceil($tcount/$rpp) : 1;
$count = 0;
$i = ($page-1)*$rpp;
while(($count<$rpp) && ($i<$tcount)) {
mysql_data_seek($result,$i);
$query = mysql_fetch_array($result);
 $uid = $query['member_id'];
 $res_award = mysql_query("SELECT * FROM `inv_awards_awarded` WHERE `user_id` = '$uid'");
$award = mysql_fetch_array($res_award);

echo '
<table>
<tr>
<td>'.$query['name'].'</td>
<td>'.$award['award_id'].'</td>
</tr>
</table>
';
$i++;
$count++;
}
echo paginate_two($reload, $page, $tpages, $adjacents);
?>

Edited by FT3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...