Question:
10 points to who can answer this question about php?
?
2011-03-30 07:49:22 UTC
In my website, I want to make it so when you log in it redirecta you to a profile page but in the URL I want to add the Id of the person that is stored in the database but how to I add variable into the URL but make it so when you Go to the actual page, it shows the number (Id) not just like: profile.php?id=$id
thanks
Five answers:
David Harris
2011-03-30 17:22:32 UTC
You want to log in to the profile of the person who's logging in?




$sql = "SELECT * FROM users WHERE user='$user' and pass='$pass'";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result)) {

//your login code here

if (...) { //the event that the username and password matched

setcookie("user",$user,time()+3600);

echo '';

}

}

?>
juliepelletier
2011-03-30 15:11:40 UTC
What you seem to be looking for is an .htaccess rule. the .htaccess file is a configuration file for the apache web server.



Although you can probably get this task done by following a simple tutorial, it has frequently been a cause of headaches, even for very advanced developers.
2011-04-02 06:13:45 UTC
u should give the redirect code



if use header, u can do this


$id = 12345;

header("location: profile.php?id=$id");

?>



if use meta


$id = 12345;

echo ';

?>



if use javascript


$id = 12345;

$url = "profile.php?id=$id";

echo "";

?>







------------------------------------

http://mikigame.com
Steve Holt
2011-03-30 15:03:31 UTC
If I understand your question correctly, you want to create a REST API for php.

I don't know how to do it exactly, but here is an article that explains it:

http://www.gen-x-design.com/archives/create-a-rest-api-with-php/

There is also the follow up article on it

http://www.gen-x-design.com/archives/making-restful-requests-in-php/
crystal lynn
2011-03-30 14:51:48 UTC
i dunno


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...