Seraskier Posted November 16, 2006 Share Posted November 16, 2006 I'm working on a website, and I need to make pages that have the users page on it. Its like a myspace that i'm making but only way way better. its going to be /index.php?v=u&(id) well I have tables in the database that are....emailFirstLastonlinelastonlinebirthdaybirthmonthbirthyear(more)and well I need a script that will display a users page. Thanks. Link to comment https://forums.phpfreaks.com/topic/27504-user-profiles/ Share on other sites More sharing options...
trq Posted November 16, 2006 Share Posted November 16, 2006 [quote]and well I need a script that will display a users page.[/quote]No. You need a tutorial on how to connect to and select data from a database. You might start [url=http://hudzilla.org/phpwiki/index.php?title=Using_MySQL_with_PHP]here[/url]. Link to comment https://forums.phpfreaks.com/topic/27504-user-profiles/#findComment-125775 Share on other sites More sharing options...
Seraskier Posted November 16, 2006 Author Share Posted November 16, 2006 Ok, what im trying to do is not working so let me show you my code so you can see what I did or did wrong.[code]<?phpinclude("connect.php");if($_GET['view'] == 'u'){ }if($_GET['id'] == ''){$result = mysql_query("SELECT first FROM users WHERE id='" . $_id . "'"); while($row = mysql_fetch_assoc($result)) { extract($row); print "$first"; } }?>[/code]I was to be able to goto "/index.php?view=u&id=7766069" and it would show me that users name and ill expand from that. Thanks. Link to comment https://forums.phpfreaks.com/topic/27504-user-profiles/#findComment-125803 Share on other sites More sharing options...
Seraskier Posted November 16, 2006 Author Share Posted November 16, 2006 anybody? I need help like asap. Link to comment https://forums.phpfreaks.com/topic/27504-user-profiles/#findComment-125812 Share on other sites More sharing options...
trq Posted November 16, 2006 Share Posted November 16, 2006 Firstly, the way you have it setup now your query will only run when no id is passed through the url. Secondly... nowhere in your code do you define $_id. Thirdly, nowhere in your database do you have a filed called id.If you had a filed in the database called id then something like this should go pretty close to working.[code]<?phpinclude("connect.php");if (isset($_GET['view']) && $_GET['view'] == 'u') { if (isset($_GET['id'])) { if ($result = mysql_query("SELECT first FROM users WHERE id='{$_GET['id']}'"); while($row = mysql_fetch_assoc($result)) { print $row['first']; } } else { echo mysql_error(); } }}?>[/code]PS; asap would normally get you [b]nowhere[/b] fast. Link to comment https://forums.phpfreaks.com/topic/27504-user-profiles/#findComment-125835 Share on other sites More sharing options...
Seraskier Posted November 16, 2006 Author Share Posted November 16, 2006 [quote author=thorpe link=topic=115244.msg469243#msg469243 date=1163717022]Firstly, the way you have it setup now your query will only run when no id is passed through the url. Secondly... nowhere in your code do you define $_id. Thirdly, nowhere in your database do you have a filed called id.If you had a filed in the database called id then something like this should go pretty close to working.[code]<?phpinclude("connect.php");if (isset($_GET['view']) && $_GET['view'] == 'u') { if (isset($_GET['id'])) { if ($result = mysql_query("SELECT first FROM users WHERE id='{$_GET['id']}'"); while($row = mysql_fetch_assoc($result)) { print $row['first']; } } else { echo mysql_error(); } }}?>[/code]PS; asap would normally get you [b]nowhere[/b] fast.[/quote]OMG I GOT IT...thanks a lot you helped me a lot. Thanks Again. Link to comment https://forums.phpfreaks.com/topic/27504-user-profiles/#findComment-125847 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.