Jump to content

Recommended Posts

I am trying to create a table so it does something like this:

 

IP1        Users Under This IP

 

                        UserName

                        UserName

                        UserName

 

IP2        Users Under This IP

 

                        UserName

                        UserName

                        UserName

 

 

I attempted it but i didnt manage it lol

 

 

This is what i got i think its cos the while loop isn't working or i got the order of it wrong.. the ip's don't go left enough and it doesn't list the user names correctly:

 

<?php
$ID = 78;
$GetIP = mysql_query("SELECT * FROM iplogs WHERE UserID='$ID'")
or die(mysql_error());
If(mysql_num_rows($GetIP) < 1){
Header("location: adminpanel.php");
}Else{
include("londonpagesinclude.php");

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>View Ips</title>
</head>
<div id="bv_" style="position:absolute;left:371px;top:276px;width:180px;height:29px;z-index:10" align="center">
<font style="font-size:24px" color="#FFFFFF" face="Arial"><b><u>Your Reports</u></b></font></div>
<div id="bv_" style="position:absolute;left:325px;top:330px;width:250px;height:224px;z-index:0" align="center">
<a href="pendingreports.php" style="color:#FFFFFF">Back</a></div>


<div id="bv_" style="position:absolute;left:300px;top:440px;width:250px;height:224px;z-index:0" align="center">

	<table width="300" border="1" cellpadding="0" cellspacing="0">
		<tr>
			<td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>UserNames</center></b></u></font></td>
	</tr>
<?php
While($row = mysql_fetch_assoc($GetIP)){
$IP = $row['IP'];
?>
<div id="bv_Text1" style="position:relative;left:10px;width:270px;height:16px;z-index:1" align="left">
<font style="font-size:13px" color="#FFFFFF" face="Arial"><b><?=$IP?></b></font></div>
<?php
$GetUsers = mysql_query("SELECT UserID FROM iplogs WHERE IP='$IP'")
or die(mysql_error());
$GetUsersrow = mysql_fetch_assoc($GetUsers);
$UserID = $GetUsersrow['UserID'];
$GetName = mysql_query("SELECT Username FROM userregistration WHERE UserID='$UserID'")
or die(mysql_Error());
$GetUsernamerow = mysql_fetch_assoc($GetName);
$UserName = $GetUsernamerow['Username'];

	?>
		<tr>	
	<td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$UserName?></center></font></td>
</tr>

</td>

<?php
}
?>
</div>

Link to comment
https://forums.phpfreaks.com/topic/82705-while-loop-issue/
Share on other sites

Please see image i have attatched.. the IP's appear above the lists of users.

 

But what is suppose to happen is list all users under each ip in this kinda layout:

 

 

IP1        Users Under This IP

 

                        UserName

                        UserName

                        UserName

 

IP2        Users Under This IP

 

                        UserName

                        UserName

                        UserName

 

 

With this image i have attatched it should look like:

 

IP1                  Users Under This IP

                                test

 

IP2                  Users Under This IP

                                test

 

But i cannot get the while loops correctly working.

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/82705-while-loop-issue/#findComment-420921
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.