maxso Posted December 24, 2008 Share Posted December 24, 2008 Ok, I have read many tutorials but non of these tutorials talk about .php?id=52 or something along the lines of that. When they register to my site they will get an ID on my database Can anybody help me with how to get that ID to make there personal part mysite.com/profile.php?id=56 I hope I made some sense Link to comment https://forums.phpfreaks.com/topic/138324-struggling-on-phpid52/ Share on other sites More sharing options...
gwydionwaters Posted December 24, 2008 Share Posted December 24, 2008 you need to post the relevant code before anyone can help you. Link to comment https://forums.phpfreaks.com/topic/138324-struggling-on-phpid52/#findComment-723276 Share on other sites More sharing options...
wildteen88 Posted December 24, 2008 Share Posted December 24, 2008 It is actually quite simple to do this. I'm assuming your users table has an id field $sql = 'SELECT id, username FROM users_table WHERE username='your_username'"; $result = mysql_query($result); $row = mysql_fetch_assoc($result); echo '<a href="profile.php?id='.$row['id'].'">View '.$row['username'].'\'s Profile</a>'; In profile.php to retrieve the id you'd use $_GET['id'] profile.php if(isset($_GET['id']) && is_numeric($_GET['id'])) { $user_id = (int) $_GET['id']; $sql = 'SELECT * FROM users_table WHERE id=$user_id"; $result = mysql_query($result); $row = mysql_fetch_assoc($result); echo '<pre>'.print_r($row, true).'</pre>'; } Link to comment https://forums.phpfreaks.com/topic/138324-struggling-on-phpid52/#findComment-723279 Share on other sites More sharing options...
maxso Posted December 24, 2008 Author Share Posted December 24, 2008 Im sorry but im realy confused. I have a profile.php with what they need to do. When a person goes to the address bar and types .../profile.php?id=6 I need my secondary database which is called 'servers' to link to the table with the name of '6'. Also it includes a text file named after the id. I am sorry if I am confusing you aswell. Link to comment https://forums.phpfreaks.com/topic/138324-struggling-on-phpid52/#findComment-723349 Share on other sites More sharing options...
maxso Posted December 24, 2008 Author Share Posted December 24, 2008 Does anyone have any tutorial i can read? What should I look in to? Link to comment https://forums.phpfreaks.com/topic/138324-struggling-on-phpid52/#findComment-723359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.