Jump to content

Recommended Posts

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?

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/149420-dynamically-displaying-variable/
Share on other sites

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

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++;
			}
			?>

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

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.