Current location: Hot Scripts Forums » Programming Languages » PHP » PHP Redirect based on username, url, using php and mysql


PHP Redirect based on username, url, using php and mysql

Reply
  #1 (permalink)  
Old 05-10-08, 12:02 AM
Vai Vai is offline
New Member
 
Join Date: May 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP Redirect based on username, url, using php and mysql

Ok,
When a user logs in they would be directed to their own page.
I am unsure how to get it to work correctly, as I can redirect to one page for all
users. Any help would be appreciated.

Table: users | id | username | password | email | url
1 | JohnQ | mypass | jq@url.com | johnq


Thanks for any and all help/suggestions.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-10-08, 03:13 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Post split and moved to PHP section.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-10-08, 03:40 AM
BurakUeda BurakUeda is offline
Newbie Coder
 
Join Date: Feb 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

$user_result mysql_query("SELECT * FROM users WHERE id = '$id' LIMIT 1");

if(
$user_result){
    
$user mysql_fetch_assoc($user_result);
} else {
    exit(
"Database error: ".mysql_error());
}

session_write_close(); //Make sure sessions are saved, if you have any.
header("location: ".$user["url"]); 
__________________
http://humo.org
Just another general discussion forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
Php based mysql query problome prasanth PHP 3 04-16-08 06:54 PM
PHP not recognizing admin in MySQL gizelle Database 3 04-15-07 09:39 PM
PHP Redirect Script based on User Text Field skipcollege Script Requests 7 09-18-05 12:03 PM
Quick Question for you php guru's Tokahashi PHP 3 04-09-04 01:00 PM


All times are GMT -5. The time now is 01:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.