How to capture from session and match database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have this session code on each page and this is working fine for
authentication:

<?
session_start();
if(!session_is_registered(email)){
header("location:store-login.php");
}
?>

Now I wish to 

1)capture the value (userName) from session on one of my pages and 
2)match it with the database and 
3)display the value in the textfields

This is the code I am using to do this please:

include "../includes/malls_db_conf.php";

$query="SELECT * FROM table WHERE email = '$email'"; <---- Here I am
capturing from the session
$result=mysql_query($query);
$num=mysql_numrows($result);

mysql_close();
{

$shopname=mysql_result($result,$i,"shopname");
$category=mysql_result($result,$i,"category");

}

?>

Showing in the textfield from the database is working fine

THE Problem is:

I am getting only the first row of table to show up and not the one with the
field $email, meaning the emailis not getting captured from the above or
checking with the table and showing me the value. 

It might be a basic one, could you please advice how to achieve that.

Cheers,

Chris
-- 
View this message in context: http://www.nabble.com/How-to-capture-from-session-and-match-database-tf4478520.html#a12770057
Sent from the Php - Database mailing list archive at Nabble.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux