frobak Posted March 17, 2009 Share Posted March 17, 2009 is it possible? i want to use a variable to display another variable thats populated by a mysql query? so far what happens is that it just prints the variable in the html page, and doesnt treat it as a variable. I am displaying the contect dynamically. basically $dl_count value is $dl_count_show1 it prints $dl_count_show1 in the html, but it should display the value of the variable, which is the result of a mysql query counting instances of a database row. hope ive explained that ok heres the code: $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> </td> <td id='mix'>"; print $dl_count; echo " </td> </tr> </table> </div>"; $i++; } ?> Link to comment https://forums.phpfreaks.com/topic/149878-solved-getting-a-variable-to-display-another-variable-possible/ Share on other sites More sharing options...
rhodesa Posted March 17, 2009 Share Posted March 17, 2009 are you looking for print $$dl_count; Link to comment https://forums.phpfreaks.com/topic/149878-solved-getting-a-variable-to-display-another-variable-possible/#findComment-787087 Share on other sites More sharing options...
frobak Posted March 17, 2009 Author Share Posted March 17, 2009 yeah that worked. I had the actual $ in the table row, which wasnt working, so i took it off and did the above and it worked. thanks Link to comment https://forums.phpfreaks.com/topic/149878-solved-getting-a-variable-to-display-another-variable-possible/#findComment-787104 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.