Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-18-2006, 09:48 AM   #1 (permalink)
backinblack
Registered User
 
Join Date: Feb 2006
Posts: 1
backinblack is on a distinguished road
linking with mysql

I have a profile form the users fill out with name, city, address, etc... It goes into the database witch then I have a page that pulls out just there name. Where I a stuck at is how do you get it to have there name being a link now and goes to there profile? Some how there is going to be a whole new page made for there profile. I am new to this so I need a little help. Thanks.
backinblack is offline   Reply With Quote
Old 02-18-2006, 09:58 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
make a field in the database for a 'user_id'. set the field as an integer, auto-increment, and primary key.

this will make it so every new person will get assigned a new user id.

if you are using PHP, then you would make a page that gets the user info based of their userid. the URL might look like this: http://example.com/profile.php?id=234

so then, you could create a list of links to user profiles like this:
PHP Code:
<?
$result 
mysql_query("select user_id, name from users");

while (
$row mysql_fetch_assoc($result)) {

  echo 
"<a href='http://example.com/profile.php?id={$row['user_id']}'>{$row['name']}</a><br />\n";
}
?>
on your profile.php page, you will need to query based off the $_GET['id'] variable.
Code:
$result = msyql_query("select * from users where user_id='" . mysql_real_escape_string($_GET['id']) . "'");
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Replication / Failover idx Everything SQL ( MySQL, MSSQL, DB2, Postgre, Oracle, etc...) 2 02-23-2005 07:22 PM
How to insert HTML form data into mysql database ? plomon PHP 5 02-06-2005 08:23 AM
and on to mysql .. sde Linux / BSD / OS X 2 01-18-2003 07:39 PM


All times are GMT -8. The time now is 02:45 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting