I can echo the session name so i know its working but it doesn't work in a MySQL query. I even tried turning it into a variable and its still not working:
File list: index.php response.php
$repname = $_SESSION['name'];
$sql = "SELECT * FROM `employee` WHERE rep='".$repname."' ";
also
$sql = "SELECT * FROM `employee` WHERE rep=".$_SESSION['name']." ";
any ideas on what's wrong?
UPDATE**
Here's the right query
$sql = "SELECT * FROM `employee` WHERE rep='".$_SESSION['name']."' ";
I know its the right query because now i'm getting records to display but its only records where rep is blank. This means i'm not getting the session name for some reason.
I tried adding:
session_start();
if(isset($_GET['name'])){
$_SESSION['name']=$_GET['name'];
}
But im still only getting records where rep is blank
$repname = $_SESSION['name']not$_SESSION['name'] = $repname$_SESSION['name']happens to contain a quote e.g.."O'Reilly". Of course, we only see code that sets a variable to a string. We don't see any code that attempts to execute that SQL statement.