user.php?id=6
to work you must make a coding in your page called
user.php
use $_GET["id"] (this will get id of the user you visit) and make a "SELECT" mysql_query to get this user info from your database and display it. :)
P.P> Here is sample:
<?php
include_once(YOURCONFIGfile.php);
if($_GET["id"]=="") { echo "ERROR: THERE IS NO SELECTED USER!"; die(); }
else
{
$html=""; //this will be our html code for output
$id = $_GET["id"];
$sql= "SELECT * FROM USERSTABLE WHERE id='".$id."'";
$res=mysql_query($sql);
while($row=myslq_fetch_array($res)){
$html.="Username: ".$row["username"]."<br>Email".$row["email"];
}
echo $html;
}
?>
This is only sample code.. it depends on your site and database structures, how it will look for you.
sv3tli0
Junior Poster in Training
83 posts since Aug 2011
Reputation Points: 10
Solved Threads: 18
Skill Endorsements: 0
If you want a better sample please provide us with your database structure and how you include your config files (for database connection and etc..)
sv3tli0
Junior Poster in Training
83 posts since Aug 2011
Reputation Points: 10
Solved Threads: 18
Skill Endorsements: 0
If you use already user.php for personal page I think it will be best to create new page called users.php which to be your users view page.
Other way if you want to use the same user.php is to set current code to be when $_GET["id"]is equal to nothing
if($_GET["id"]=="") { current page code }
else { new code as the example which I gave you }
The $_GET[] is getting info from page url entered . its reading this way
page.php?STRING1=VALUE1&STRING2=VALUE2&STRING3=VALUE3
this url will provide you with gets like this :
$_GET["STRING1"] = VALUE1;
$_GET["STRING2"] = VALUE2;
$_GET["STRING3"] = VALUE3;
In inputs form this is claled method="get"
its good only if you use it for display pages. Its not good offer for login or other forms where you have protected data as password, mail or other personal data
sv3tli0
Junior Poster in Training
83 posts since Aug 2011
Reputation Points: 10
Solved Threads: 18
Skill Endorsements: 0
Question Answered as of 1 Year Ago by
sv3tli0