Jump to content

Archived

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

rallokkcaz

how to make pages like blah?user=username

Recommended Posts

ok i will thanks for the posts
they are

id
username
password
email
fullname

Share this post


Link to post
Share on other sites
<?php
//##your db script##
include("config.php");

if($_GET['uid'])
{
$id = $_GET['uid'];
$get['userdata'] = mysql_query("SELECT * FROM pokebash_users WHERE id='$id'");

$get['userdata'] = mysql_fetch_array($get['userdata']);

echo 'Username: ' .$get['userdata']['username'] .'<br />';
echo 'E-mail: ' .$get['userdata']['email'] .'<br />';
echo 'fullname: ' .$get['userdata']['fullname'];

}
else
{
//########REDIRECTS TO YOUR HOME PAGE IF UID IS NOT PRESENT IN THE URL#########
echo '<meta http-equiv="refresh" content="0;URL=index.php" />';
}
?>

That'd work I think :)

you should now use something like user.php?id=1  or any id you want

Share this post


Link to post
Share on other sites
ok here's the code
when ever i click on the link to view the profile
it sends me back to the same page with a different url
here's the page
[url=http://www.pokebash.com/user.php]http://www.pokebash.com/user.php[/url]
heres the code
[code]<? include ("header.php"); ?>

<?php
  //connect to and select db
  $conn = mysql_connect('localhost','//yes i left these blank for secrurity purposes','') or die(mysql_error());
  $db = mysql_select_db('pokebash_users',$conn) or die(mysql_error());
 
  //get a list of the info from the table to make the linkies
  $sql = "select * from maaking_users";
  $result = mysql_query($sql, $conn) or die(mysql_error());

  // for each row fetched from the results... 
  while ($list = mysql_fetch_array($result)) {
      //make the custom linkie
      echo "<font color='black'><a href= 'http://www.pokebash.com/user.php?id={$list['userid']}'>{$list['username']}</a><br>";
  } // end while

  // if the user clicked on a linkie and therefore an id exists (the is_numeric is a basic security precaution) ...
  if (is_numeric($_GET['username'])) {
      // for easier var syntax handling
      $id = $_GET['userid'];
     
     
      $sql = "select username from maaking_users where video_id = '$id'";
      $result = mysql_query($sql, $conn) or die(mysql_error());

      $videofound = mysql_num_rows($result);
      if ($videofound) {
        $user = mysql_fetch_array($result);
        include ("header.php");
echo "  ";

      } // end if found
  } // end if there was a linkie clicked
?>

<?php
//##your db script##

if($_GET['userid'])
{
$id = $_GET['userid'];
$get['userdata'] = mysql_query("SELECT * FROM pokebash_users WHERE userid='$id'");

$get['userdata'] = mysql_fetch_array($get['userdata']);

echo 'Username: ' .$get['userdata']['username'] .'
';
echo 'E-mail: ' .$get['userdata']['email'] .'
';
echo 'fullname: ' .$get['userdata']['fullname'];

}

?>[/code]

Share this post


Link to post
Share on other sites

×

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.