I couldn't register php session from mysql query. Can you tell me what is the correct method to register php session in mysql field. I tried many ways. Still no solution.

$sql=("SELECT email FROM people");

$result=mysql_query($sql);

$email = mysql_fetch_array($result);

echo $email['email'];

//could not register this way 
session_register("$email");

$email = mysql_fetch_array($result);

$email1 = $email;

session_register("$email1");

$email = mysql_fetch_array($result);

$email1 = $email;

session_register("$email1");

I got the php error message. I tried same code as given by you. Any advice pls.

Deprecated: Function session_register() is deprecated

i mean

session_start("$email1");

i mean

session_start("$email1");

Thanks. No error found. but I try to pass the session to next page. I am using

//page2.php 

session_start(); 

//session_start("$email"); 

echo $_SESSION["email"];

How can I retrieve from sessions

//page2.php

session_start();

//session_start("$email");

echo $_SESSION["email1"];

you forgot to put 1 after email.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.