Jump to content

Archived

This topic is now archived and is closed to further replies.

mycosis

Mysql resoult with another connect and resoult inside it! help

Recommended Posts

[code]<?
include("db.inc.php");
//stat
mysql_connect($db,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM ipstats";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) {

$id=mysql_result($result,$i,"id");
$ip=mysql_result($result,$i,"ip");
$on=mysql_result($result,$i,"online");
$lu=mysql_result($result,$i,"last_used");

echo"<table width='600' border='1' cellspacing='0' cellpadding='0'>
  <tr>
    <td width='200' align='left' valign='top'>ID: $id<br />
IP: $ip<br />
$online<br />
Sisst sett: $lu</td>

    <td width='400' align='left' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='0'>";
// Slutt stat
// Start nickstat
mysql_connect($db,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
query
$query2="SELECT *
FROM `ipstats_nicks`
WHERE ipstats_id =$id
ORDER BY nick ASC";
$result2=mysql_query($query2);
$num2=mysql_numrows($result2);
mysql_close();
echo"<tr>
        <td>Nick:</td>
        <td>Brukt:</td>
        <td>Online:</td>
        <td>Sisst brukt:</td>
    </tr>";
while ($i2 < $num2) {
$nick=mysql_result($result2,$i2,"nick");
$brukt=mysql_result($result2,$i2,"used_times");
$onnick=mysql_result($result2,$i2,"online");
$lunick=mysql_result($result2,$i2,"last_used");

echo" <tr>
        <td>$nick</td>
        <td>$brukt gang(er) </td>
        <td>$onnick</td>
        <td>$lunick</td>
      </tr>";
$i2++;
}
// Slutt nickstat
// Start stat
echo"</table>
    </td>
  </tr>
</table>
<br />
<br />";
$i++;
}
?>[/code]

It is two record in the DB (see here: http://elmannen.net/dc%20stats/), but the second onne isn't getting any result. why?
I think its because $query2 and those come again at second loop...
PLZ help, how can i get it going?

Share this post


Link to post
Share on other sites

×

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.