Jump to content

i'm confused variables not taking the value


ankycooper

Recommended Posts

i have a code as follows
[code]
<?php
session_start();
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true ||

!isset($_SESSION['info']) || $_SESSION['info'] !== true) {
// not logged in, move to login page
header('Location: index.php');
exit;
}


include 'dbinfo.inc.php';
@mysql_connect($host,$user_name,$pass_word)or die( "Unable to Connect to database");
@mysql_select_db($database) or die( "Unable to select database");
$username=$_SESSION['username'];

$sql = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($sql) or die('Query failed. ' . mysql_error());
list($id, $usnme, $specialty, $p, $name, $bdname, $tlname, $mgrname, $myno, $bdno,  $tlno,

$mgrno, $mymail, $bdmail, $tlmail, $mgrmail, $myt, $bdt, $tlt, $mgrt) =

mysql_fetch_array($result, MYSQL_NUM);

$sqlsugg = "SELECT * FROM mf where mfname='openingmail'";
$resultsugg = mysql_query($sqlsugg) or die('Query failed. ' . mysql_error()); 
list($mfid, $mfname, $mfcon) = mysql_fetch_array($resultsugg, MYSQL_NUM) or die('Query

failed. ' . mysql_error()); 

$srx="333";
$cname="1111";
$issue="3333";
$cmail="3333";

$mfcone=$mfcon;
echo $mfcone;

?>
[/code]

it echo's  value of $mfcone as
[quote]Hello $cname, Thank you for contacting Support. I am the Support Professional who will work with you on the case '$srx'. You can reach me using the contact information mentioned below. Please be sure to include your case number. As discussed, the issue we are trying to resolve is '$issue' We would consider this incident completed and closed only when the issue is resolved. Hope we are on the same page with the understanding of the issue. Thank you for calling[/quote]

and does not include the value of the variables


$srx="333";
$cname="1111";
$issue="3333";

Please Help
The $mfcon has
[quote]Hello $cname, Thank you for contacting Support. I am the Support Professional who will work with you on the case '$srx'. You can reach me using the contact information mentioned below. Please be sure to include your case number. As discussed, the issue we are trying to resolve is '$issue' We would consider this incident completed and closed only when the issue is resolved. Hope we are on the same page with the understanding of the issue. Thank you for calling
[/quote]
but it is  not taking up the values of the variables
$srx="333";
$cname="1111";
$issue="3333";
When you retreive $mfcon from the database, it's just a string. PHP doesn't look at it to make any variable substitutions. You either need to pass it through the eval() function or use the str_replace() function to get the variable names replaced with their values.

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.