Jump to content


Custom URL


14 replies to this topic

#1 demonix

    Young Padawan

  • Members
  • Pip
  • 26 posts

Posted 25 January 2006 - 02:22 PM

ok... how can i have it so that my page users.php becomes users.php?44mv392 (or something like that) does that have to do with the user session or something?

#2 HaloprO

    Requires Armed Escort

  • Members
  • PipPip
  • 310 posts
  • Gender:Male
  • Location:California, USA

Posted 25 January 2006 - 02:36 PM

Are you trying to make it so they can view a profile by doing something like
users.php?user=bob

#3 demonix

    Young Padawan

  • Members
  • Pip
  • 26 posts

Posted 25 January 2006 - 02:56 PM

basically... cant really think of how to say it other than that ^^

#4 HaloprO

    Requires Armed Escort

  • Members
  • PipPip
  • 310 posts
  • Gender:Male
  • Location:California, USA

Posted 25 January 2006 - 03:00 PM

You are going to need to setup a user table inside of a database
<?php
$username = mysql_real_escape_string($_GET['user']);
$sql = "SELECT * FROM `users` WHERE `username` = '$username' LIMIT 1";
$q = mysql_query($sql);
$n = mysql_num_rows($q);
if ($n) {
	$r = mysql_fetch_assoc($q);
	echo "The username is: $r[username]";
} else {
	die('Username not found.');
}
?>
Something like that, you should get the jist of it

Edited by HaloprO, 25 January 2006 - 03:01 PM.


#5 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 25 January 2006 - 03:02 PM

This has been asked many times before, im sure if you search for it, it will come up with something usefull

http://www.pixel2life.com/forums/index.php...&hl=php+include

#6 HaloprO

    Requires Armed Escort

  • Members
  • PipPip
  • 310 posts
  • Gender:Male
  • Location:California, USA

Posted 25 January 2006 - 03:10 PM

Come on avalance be nice, he said he didn't know what to call it, so he wouldn't know what to search for, and he's not looking for a php include

#7 meadow

    Young Padawan

  • Members
  • Pip
  • 224 posts
  • Location:Devon, England
  • Interests:Php, Hockey, mysql, web design.

Posted 25 January 2006 - 03:39 PM

I think you want something like this: http://www.pixel2life.com/tutorials/PHP_Co...1&ss=navigation Good luck!

#8 HaloprO

    Requires Armed Escort

  • Members
  • PipPip
  • 310 posts
  • Gender:Male
  • Location:California, USA

Posted 25 January 2006 - 04:14 PM

Do you guys not see that he wants to know how to get users from a database?

#9 demonix

    Young Padawan

  • Members
  • Pip
  • 26 posts

Posted 25 January 2006 - 04:22 PM

no... i know how to get users from a database... thats easy :love:

what im trying to do is sort of what the topic avalanche put... like the index.php?section=support... basically thats what im trying to do.

#10 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 25 January 2006 - 04:46 PM

i win :love:

#11 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 25 January 2006 - 06:18 PM

Ok, settle down, this isn't a race to prove who is or is not right. Avalance, you were a bit of, but the same concept of what's in that link still applies.
But demonix, that stuff after and including the '?' in the url is known as a query string. In php, you get stuff out of that string through the $_GET var.
http://www.php.net/manual/en/reserved.vari...d.variables.get <-- more info.

#12 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 26 January 2006 - 10:45 AM

i was just kidding, nothing serious :blink:

#13 demonix

    Young Padawan

  • Members
  • Pip
  • 26 posts

Posted 27 January 2006 - 02:47 PM

ok... so i now have the hang of individual query strings... but what about multiple ones? eg index.php?act=test&id=1

#14 Blitz

    Jedi In Training

  • Twodded Staff
  • PipPip
  • 307 posts
  • Location:California
  • Interests:Php, html, css, etc, band, trumpet, anime, my dog, TV, computers, video games, sleeping, marching band, sleeping, jazz, sleeping, metal, sleeping, classic rock, sleeping, music, jazz band, did I mention sleeping?, kicking the hell out of kids that won't take the time to spell or use proper grammar, my website, etc.

Posted 27 January 2006 - 04:06 PM

They're accessed the same way. $_GET['act'] would have the value 'test' and $_GET['id'] would have the value 1.

#15 Nike

    Young Padawan

  • Members
  • Pip
  • 204 posts
  • Location:Ohio
  • Interests:Controlling the human and and duck race.

Posted 27 January 2006 - 05:18 PM

Oh, you want PHP Navigation. http://www.techtuts....=tutorial&id=52





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users