ankycooper Posted August 23, 2006 Share Posted August 23, 2006 i have a code as follows[code]<?phpsession_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 Quote Link to comment https://forums.phpfreaks.com/topic/18405-im-confused-variables-not-taking-the-value/ Share on other sites More sharing options...
wildteen88 Posted August 23, 2006 Share Posted August 23, 2006 I see $mfcon is coming from a your mf table in the database. What does $mfcon hold? Quote Link to comment https://forums.phpfreaks.com/topic/18405-im-confused-variables-not-taking-the-value/#findComment-79110 Share on other sites More sharing options...
ankycooper Posted August 23, 2006 Author Share Posted August 23, 2006 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"; Quote Link to comment https://forums.phpfreaks.com/topic/18405-im-confused-variables-not-taking-the-value/#findComment-79112 Share on other sites More sharing options...
kenrbnsn Posted August 23, 2006 Share Posted August 23, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/18405-im-confused-variables-not-taking-the-value/#findComment-79116 Share on other sites More sharing options...
ankycooper Posted August 23, 2006 Author Share Posted August 23, 2006 Thanks Man eval("\$mfcon = \"$mfcon\";");worked for me Quote Link to comment https://forums.phpfreaks.com/topic/18405-im-confused-variables-not-taking-the-value/#findComment-79117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.