Jump to content

User Profiles


Seraskier

Recommended Posts

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....

email
First
Last
online
lastonline
birthday
birthmonth
birthyear
(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

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]
<?php
include("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

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]
<?php
include("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

[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]
<?php
include("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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.