I have MYSQL query like the below:
$sourcedata = mysql_fetch_array(
mysql_query("SELECT Whereclause
FROM generaltable
WHERE ID = '1'"
)
);
$Whereclause = $sourcedata['Whereclause'];
In "Whereclause" field from "generaltable" in database, consist of the below text:
WHERE username = '$_SESSION[username]'
Then I have other query:
$data = mysql_fetch_array(
mysql_query("SELECT *
FROM usertable
$Whereclause"
)
);
When I echo $data['username'],
it is not showing anything.
If I copy the value from database to replace $Whereclause it is working fine, also if I replace '$_SESSION[username]' with 'admin' for example, it is working fine.
How can I solve this? Need your help please.
Thank you very much.