Note that there are some explanatory texts on larger screens.

plurals
  1. POstore a mysql array records in session
    text
    copied!<p>I have a school web application .. I want to get all the student name on the log_in.php pages in $_SESSION['allStudent'] for retrieve on further page...</p> <p>here is my log in .php pages content</p> <pre><code> include("connect.php"); if(isset($_REQUEST['submit'])) { $id=$_REQUEST['userName']; $pass=$_REQUEST['password']; $sel=mysql_query("select * from login_detail where USERNAME='$id' AND PASSWORD='$pass'")or die(mysql_error()); if($arr=mysql_fetch_array($sel)) { if(($id==$arr['USERNAME']) &amp;&amp; ($pass==$arr['PASSWORD'])) { session_start(); $_SESSION['id']=$id; $query = "SELECT * FROM student_personal"; $result = mysql_query($query) or die(mysql_error()); if($result) { $_SESSION['allStudent']['']= mysql_fetch_array($result); } header("location: viewPages/common/main.php?active=dashboard"); } } else { echo "&lt;script&gt;alert('please enter the correct id and password');&lt;/script&gt;"; } } </code></pre> <p>and retrieve into main page this is my main pages</p> <pre><code> { //designed Part } &lt;?php if(isset($_SESION['allStudent'])) { echo "------------------------------------------&lt;br&gt;"; echo "Student Name--------------------------- DOB&lt;br&gt;"; echo "------------------------------------------&lt;br&gt;"; while($row = mysql_fetch_array($_SESSION['allStudent'])) { echo $row['STUDENT_NAME']." --------------".$row['DOB']."&lt;br&gt;"; } } else { echo "No result Found"; } ?&gt; </code></pre> <p>and this is my table</p> <pre><code> DB NAME : testssdb Table Name : student_personal `SR_NUMBER` int(11) NOT NULL, `STUDENT_NAME` varchar(30) NOT NULL, `GENDER` int(11) NOT NULL, `DOB` varchar(25) NOT NULL, `RELIGION` varchar(30) NOT NULL, `MAILING_ADDRESS` text NOT NULL, `TELEPHONE_NO` varchar(22) default NULL, `MOBILE_NO` varchar(25) default NULL, `EMAIL` varchar(30) default NULL, `PERMANENT_ADDRESS` text, `MOTHER_TONGUE` varchar(30) default NULL, `CATEGORY` int(11) default NULL, `STATUS` int(11) NOT NULL default '1', `REG_DATE` date NOT NULL, `FIRST_NAME` varchar(25) NOT NULL, `LAST_NAME` varchar(25) NOT NULL, PRIMARY KEY (`SR_NUMBER`) </code></pre> <p><br> <br> <br></p> <p>Here $student = $firstname.$lastName; So basically i want to store all student records on log in and anyneed of student,i do not want to intrect with the database. only use of session i get the student information</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload