List Info

Thread: how do you select single record from Mysql using PHP




how do you select single record from Mysql using PHP
user name
2006-08-11 15:06:09
Basically im setting up user based website. I need to know
the best way
to auth a user to login and then how to retrieve all the
relevant
information for this user once logged in can anybody help

Ive read about $_sessions and cookies but i need a step by
step guide
pls help

Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://groups
.google.com/group/phpmysql
-~----------~----~----~----~------~----~------~--~---

how do you select single record from Mysql using PHP
user name
2006-08-12 12:07:55
automaticly you should make a SQL query to retive the info ,
and u
parse the var from the SESSION


$query = mysql_query("SELECT * FROM usertabel  WHERE
user=$user_session");
and $user_session should be the username of user and should
be stored
in session when the pass & user is correct when the
visitor try to auth


<?php
$username =trim(addslashes($userlog));
$password = md5($passlog);
$query_1 = mysql_query("SELECT * FROM hs_users WHERE
username='$username' and password='$password' and
active='1'");

$singin = mysql_num_rows($query_1);

if($singin !=0){
$_SESSION['user_session'] = $username;

header("Location: index.php");

}
if($singin==0){
warning("ERROR");
}
?>



Flickle wrote:
> Basically im setting up user based website. I need to
know the best way
> to auth a user to login and then how to retrieve all
the relevant
> information for this user once logged in can anybody
help
>
> Ive read about $_sessions and cookies but i need a step
by step guide
> pls help
> 
> Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP & MySQL" group.
To post to this group, send email to phpmysqlgooglegroups.com
To unsubscribe from this group, send email to
phpmysql-unsubscribegooglegroups.com
For more options, visit this group at http://groups
.google.com/group/phpmysql
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )