FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


searching users





riyadh
how do i write something which will let me search registered users on my site? also how do i make a page, tht is the profile, which will output data according to the user id??
rvec
You can use a $_GET variable for the userid and search for that id in the database. I'll write something if you'd like that.
Diablosblizz
riyadh wrote:
how do i write something which will let me search registered users on my site? also how do i make a page, tht is the profile, which will output data according to the user id??


Depending on your database, you could do a MySQL query selecting the fields from the table and you echoing it out on your page. It can be simply done.
kv
Assuming the table structure below

Code:
Users
-------------------------------------------------------------
|  id  |  name  |  password  |  regdate  | status  | etc ...|
-------------------------------------------------------------


You can do a query

Code:
"SELECT name, regdate, status FROM Users WHERE id='$id'"
rvec
kv wrote:
Assuming the table structure below

Code:
Users
-------------------------------------------------------------
|  id  |  name  |  password  |  regdate  | status  | etc ...|
-------------------------------------------------------------


You can do a query

Code:
"SELECT name, regdate, status FROM Users WHERE id='$id'"

With that you can make something like this:

Code:

if (isset($_GET['id'])) {
   $id = (int) $_GET['id'];

   $link = mysql_connect('localhost', 'username', 'password')       //change the pass and username
      or die('Could not connect: ' . mysql_error());
   mysql_select_db('database') or die('Could not select database');      //change the database
   
   $query = "SELECT name, regdate, status FROM Users WHERE id='$id' LIMIT 1";
   $result = mysql_query($query)
   
   $user = mysql_fetch_array( $result );
   
   echo 'username: '. $user['nick'] .'<br />Registered since: '. $user['regdate'];
   
} else {
   echo "No userid given";
}
?>
Related topics
Searching for script masters FLASH 8 USERS OR PROGRAMMING
If you want more users
show *recent* forum users
mIRC for begginers.
IE 7 to take a cue from Firefox
751 Useful Windows XP Files
I searching for a site
Skype
.Com domain
users online, using php and text file
Linux users - Which window manager do you prefer the most
Windows Vista Official Thread
Ecommerce
Windows File System Explained
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.