I have a php class that deals with MySql data given below
<?php
class DB_Functions
{
function __construct()
{
require_once 'DB_Connect.php';
$db=new DB_Connect();
$db->connect();
}
function __destruct()
{
}
public function getDetails($username,$password)
{
$result = mysql_query("Select * from teachertb where Username = '$username' and password = '$password'") or die(mysql_error());
$no_of_rows = mysql_num_rows($result);
if($no_of_rows>0)
{
return $result;
}
else
{
return false;
}
}
public function getClass($res)
{
while($r=mysql_fetch_array($res))
{
echo $r[0]."<br>";
echo $r[1]."<br>";
echo $r[2]."<br>";
echo $r[3]."<br>";
}
}
}
$d=new DB_Functions();
$res=$d->getDetails("abcd","abcd");
$d->getClass($res);
while($r=mysql_fetch_array($res))
{
echo $r[0]."<br>";
echo $r[1]."<br>";
echo $r[2]."<br>";
echo $r[3]."<br>";
}
?>
In this code actually i want to use the resultset to display the data from the table and use the same resultset in the other function to do some other functionality using the data. But i've noticed that the same resultset cannot be used more than one times. Why is it so? And how can i use the same resultset multiple times.