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
Link to comment
Share on other sites

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";
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.