Current location: Hot Scripts Forums » Programming Languages » PHP » getting a variable to display another variable?


getting a variable to display another variable?

Reply
  #1 (permalink)  
Old 03-17-09, 02:45 PM
frobak frobak is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
getting a variable to display another variable?

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.

PHP 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++;
                }
                
?> 
Reply With Quote
  #2 (permalink)  
Old 03-17-09, 02:46 PM
frobak frobak is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
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.

hopw ive explained that ok
Reply With Quote
  #3 (permalink)  
Old 03-17-09, 03:23 PM
frobak frobak is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
i got it working ok now, thanks anyway!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 08:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.