i am making a website and some part of which is to show user information...for this i had make a class and functions within it...one of the function is for retrieving values from database(im using mysql)...i know a variable is limited only in function,also tried $_session for this too..the function works fine ....but it is not sendind the information to the page from where im calling it...here is my code.....
in xyz.php file
<?php
class book{
public $v1;
public $v2;
public $v3;
function book(){
}
function page1(){
$this->con=mysql_connect("localhost","root","usa");
$this->db=mysql_select_db("truth",$this->con);
}
function page2($xyz){
$this->page1();
$query="SELECT * FROM member_signup WHERE Uid=$xyz";
$result=mysql_query($query,$this->con);
$result1=mysql_fetch_array($result);
$_SESSION['info']=$result1;
return $_SESSION['info'];
return $result1;
}
}?>
in show.php file
<?
require_once("xyz.php");
$pen = new book;
if($pen->page2(100011))
{ session_start();
if (mysql_error())
{ print "Database ERROR: " . mysql_error(); }
else{
echo "cows";
echo "<br>cows<br>";
echo "my name is'".$_SESSION['info']."'";
echo "my name is'".$_SESSION['FIRST_NAME']."'"; //i have a fied is db named FIRST_NAME
}
}
else{echo "happy";}
?>