frobak Posted March 14, 2009 Share Posted March 14, 2009 Hi i am trying to get a variable to be echo'd on a page that is being produced dynamically from a database table. So i have got the entire php code (<?php echo $dl_count_show1neilsodfrobak; ?>) in a database row and it should be returned in a html table row, but it doesnt work, even though when i view source the php code is there but it doesnt echo the variable. viewing through firefox view source the text is pink? any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/ Share on other sites More sharing options...
zq29 Posted March 14, 2009 Share Posted March 14, 2009 Post up your code. Help us, help you. Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784743 Share on other sites More sharing options...
Zane Posted March 14, 2009 Share Posted March 14, 2009 even though when i view source the php code is there but it doesnt echo the variable. viewing through firefox view source the text is pink? if you can see PHP code in View Source.....PHP is not installed correctly...well....at all technically Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784749 Share on other sites More sharing options...
frobak Posted March 14, 2009 Author Share Posted March 14, 2009 Heres the dynamically produced content At the end of the download link, there should be a download count, the variable $dl_count, the value of download count is <?php echo $dl_count_show1neilsodfrobak; ?> <? include("includes/db_connect.inc.php"); $query="SELECT * FROM pbzarchive ORDER BY date_added"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $mix_title = mysql_result($result,$i,'mix_title'); $djname = mysql_result($result,$i,"djname"); $mix_length = mysql_result($result,$i,"mix_length"); $mix_size = mysql_result($result,$i,"mix_size"); $filename = mysql_result($result,$i,"filename"); $dl_count = mysql_result($result,$i,"dl_count"); echo "<div class='mix'> <table id='mix'> <th colspan='2'>$mix_title </th> <tr> <td id='mix'>DJ's : </td> <td id='mix'>$djname </td> </tr> <tr> <td id='mix'>Mix length : </td> <td id='mix'>$mix_length </td> </tr> <tr> <td id='mix'>Mix size : </td> <td id='mix'>$mix_size </td> </tr> <tr> <td id='mix'><A href='../downloads/$filename.php' onClick='popup = window.open('downloads/$filename.php', 'PopupPage', 'height=135,width=265,scrollbars=no,resizable=no'); return false' target='_blank'>Download</a>$dl_count </td> <td id='mix'> </td> </tr> </table> </div>"; $i++; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784750 Share on other sites More sharing options...
Zane Posted March 14, 2009 Share Posted March 14, 2009 -don't use short tags -what is $dl_count_show1neilsodfrobak again? -have you tried using $dl_count_show1neilsodfrobak in place of $dl_count? - use CODE TAGS(#) next time Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784762 Share on other sites More sharing options...
frobak Posted March 14, 2009 Author Share Posted March 14, 2009 what are short tags? what are code tags? $dl_count_show1neilsodfrobak is the result of a mysql query counting the instances of show1neilsodfrobak in the table, and returning the amount of rows. i cant use it instead of $dl_count, because theres many rows so i need each one to have its own code Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784773 Share on other sites More sharing options...
frobak Posted March 14, 2009 Author Share Posted March 14, 2009 so when i view the source, the correct code is there: <?php echo $dl_count_show1neilsodfrobak; ?> but it doesnt display the variable, it doesnt write it in html either? wtf? Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784793 Share on other sites More sharing options...
frobak Posted March 14, 2009 Author Share Posted March 14, 2009 right, so basically i cannot have some php code in my dynamically displayed html, it just doesnt recognise the code Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784890 Share on other sites More sharing options...
trq Posted March 15, 2009 Share Posted March 15, 2009 Why on earth are you storing php in a database? It makes no sense to do so. You are like the third person to try this this week. There must be some dodgy book getting around or something. Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784915 Share on other sites More sharing options...
frobak Posted March 15, 2009 Author Share Posted March 15, 2009 i tried it because it wasnt working when i concatenated the variable to the php code in the html? just trying other things Quote Link to comment https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/#findComment-784925 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.