Because you're passing a string - it's already parsed.
when it enters the function, the variables will already have been replaced by the values of the variables before execution.
What you're trying to do is templating - try this.
PHP Code:
function Display($table,$WHERE,$prehead,$return)
{
//
global $con;
global $data;
$Query="SELECT * FROM $table WHERE $WHERE";
$rs=mysqli_query($con,$Query);
if(!$rs)
{
echo "Error".mysqli_error($con);
}
else
{
//
$count=$rs->num_rows;
if($count=1)
{
if(!$prehead == "")
{
echo $prehead;
}
while($data=$rs->fetch_assoc())
{
print_r($data);
//3aecho
foreach($data AS $key => $value) {
str_replace("#".$key."#",$value,$return);
}
echo "Pre".$return."";
}
}
else
{
echo "No Such Records";
}
}
//
}
Display("members","username='demo'","<h1>Showing Member information of</h1>","<table>
<tr>
<th>Member</th>
<th>#username#</th>
</tr>
<tr>
<th>Rank</th>
<th>#rank#</th>
</tr>
<tr>
<th>email</th>
<th>#email#</th>
</tr>
</table>");
Bookmarks