dennismonsewicz Posted March 12, 2009 Share Posted March 12, 2009 I have a sql db that contains a variable ($callNumber) and in my PHP I have a switch that sets that var but when the statement is printed out on the page it is printing out $callNumber instead of the actual value of the variable... any ideas? Link to comment https://forums.phpfreaks.com/topic/149154-solved-echoing-var-from-sql-db/ Share on other sites More sharing options...
lonewolf217 Posted March 12, 2009 Share Posted March 12, 2009 post the relevant code Link to comment https://forums.phpfreaks.com/topic/149154-solved-echoing-var-from-sql-db/#findComment-783165 Share on other sites More sharing options...
dennismonsewicz Posted March 12, 2009 Author Share Posted March 12, 2009 <?php $help_db =& JFactory::getDBO(); $msgid = $_GET['msgid']; $carrier = $_GET['carrier']; if (!$msgid || $msgid == '') { $msgid = 'START_NEW_CLAIM'; } if(isset($carrier)) { switch($carrier) { case "number1": $callNumber = "1-800-555-5555"; $link = "http://www.google.com"; break; case "number2": $callNumber = "1-800-111-1111"; $link = "http://www.yahoo.com"; break; case "number3": $callNumber = "1-800-222-2222"; $link = "http://www.msn.com"; break; case "number4": $callNumber = "1-800-333-3333"; $link = "http://www.aol.com"; break; } } $help_db->setQuery("SELECT page, sorter, question, answer, published FROM #__db_name WHERE page = '" . $msgid . "' ORDER BY sorter"); $help_rows = $help_db->loadObjectList(); foreach($help_rows as $row) { if ($row->published == 1) { echo "<p>"; echo "<strong>".$row->question."</strong><br/>"; echo $row->answer; echo "</p>"; } } ?> SQL string ('msgid_var here',2,'The data I entered is correct. How do I continue?','$callNumber',1), Link to comment https://forums.phpfreaks.com/topic/149154-solved-echoing-var-from-sql-db/#findComment-783169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.