I have create the list can show all the account.
Here is the php,i have show all the login account name.and how to get a href to their only file .
example i get the account name call "admin",and then show on table .now i need to create a link on "admin" this word.so when i kick "admin" , i can see his profile in a new page. and how to do it ?
(((((echo all account 's php)))))
$con1 = mysql_connect("127.0.0.1","root","password");
mysql_select_db("babytradeapps");
$sql1 = "Select LoginID , Permission
from loginacc where Permission = 2 ";
$results = mysql_query($sql1,$con1);
echo "<table border=5 cellpadding=10>";
echo "<tr><th>members</th></tr>";
while($row = mysql_fetch_array($results)) {
echo "<td>$row[0]</td>";
}
echo "</table>";
Put the link in your echo
statement:
echo "<td><a href='profile.php?id={$row['LoginID']}'>$row['LoginID']}</a></td>;
What I outline here is the most basic of solutions to your problem, so that you may understand what needs to be done. DON'T USE IT IN PRODUCTION.
First we have to create a hyperlink to a PHP page that will pull out the user's data. [This assumes that the user's name is denoted by the 'LoginID' column.]
echo "<td><a href='userinfo.php?user=".$row['LoginID']."'>".$row['LoginID']."</a></td>";
Next, create a page called userinfo.php (for example), and get
the value of the user
key via PHP.
<?php
$requestedUsername = $_GET['user'];
/** Over here, you'll have to draw the user's data from the database for `echo`ing out later.
You can use something like: $query = "Select `email`, `address`, `phone` from `loginacc` where `LoginID` = '$requestedUsername'";
However, as I stated in my hint above, please refrain from using mysql_* functions. They bite back. **/
echo $requestedUsername;
?>
That's it!