Welcome Guest, Not a member yet? Register   Sign In
session looses data
#1

[eluser]emperius[/eluser]
I have few types of search criteria and i'm trying to mke different queries depending from url and post data

here is the examle code

Code:
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
    $sql = "SELECT
                 Object.ID,
                Object.NasPunkt,
                Object.Area,
                Road.Value AS Road,
                District.Value AS District
            FROM
                Object
            LEFT OUTER JOIN
                Road
                    ON Road.ID = Object.RoadID
            LEFT OUTER JOIN
                District
                    ON District.ID = Object.DistrictID
            WHERE
                1=1
            ";
            
    echo "<h1>1</h1>";
}
elseif ($uri1 == 'acatalog')
{
    $sql = "SELECT
                 Object.ID,
                Object.NasPunkt,
                Object.Area,
                Road.Value AS Road,
                District.Value AS District
            FROM
                Object
            LEFT OUTER JOIN
                Road
                    ON Road.ID = Object.RoadID
            LEFT OUTER JOIN
                District
                    ON District.ID = Object.DistrictID
            ORDER BY ID DESC
            ";    
    echo "<h1>2</h1>";            
}
elseif($uri1 == 'letter')
{
    $letter = urldecode($uri2);
    $sql = "SELECT
                 Object.ID,
                Object.NasPunkt,
                Object.Area,
                Road.Value AS Road,
                District.Value AS District
            FROM
                Object
            LEFT OUTER JOIN
                Road
                    ON Road.ID = Object.RoadID
            LEFT OUTER JOIN
                District
                    ON District.ID = Object.DistrictID
            WHERE LOWER(Object.NasPunkt) LIKE '$letter%'                    
            ORDER BY ID DESC
            ";
    echo "<h1>3</h1>";            
}  

if(!empty($sql))
{
    $this->session->set_userdata('equery', $sql);
}
else
{
    $sql = $this->session->userdata('equery');
}

everything works fine except case with post. Session data is saved, and after I go on other page session variable becomes empty.

What may be a reason?
#2

[eluser]pistolPete[/eluser]
What CI version are you using?

Why do you save SQL in the session data?




Theme © iAndrew 2016 - Forum software by © MyBB