Answer the question
In order to leave comments, you need to log in
How to get records from the database when authorizing a user?
Hello! I have a small problem: how do I pull out the date of birth, first name and last name from the database?
The bottom line is that the username and password are recorded in cookies. Did this example . I changed the registration form and id, login, pass, fname, lname, bday, bmonth and byear are written to the database.
Thanks in advance for your reply.
UPD:
Here is the code that checks cookies for login and pass:
<?
include_once 'db_connect.php';
if(!empty($_COOKIE['login']) AND !empty($_COOKIE['pass'])) {
$search_user = mysql_query("SELECT * FROM `profiles` WHERE `login` = '".mysql_real_escape_string($_COOKIE['login'])."' AND `pass` = '".mysql_real_escape_string($_COOKIE['pass'])."'");
$user = (mysql_num_rows($search_user) == 1) ? mysql_fetch_array($search_user) : 0;
}
else {
$user = 0;
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question