View Single Post
Old 06-25-2009, 02:18 PM   #7 (permalink)
Izzmo
v7n Mentor
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 1,338
iTrader: 0 / 0%
Latest Blog:
None

Izzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web proIzzmo is a highly respected web pro
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
This should work for you.

You just have to create a counter in the PHP and then add that count to the id.

I have updated the JavaScript slightly as well.

Code:
<script language="javascript"> function toggle(num) { var ele = document.getElementById("toggleText"+num); var text = document.getElementById("displayText"+num); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "Show Available Languages"; } else { ele.style.display = "block"; text.innerHTML = "Hide Languages"; } } </script>
PHP Code:
$result_publication mysql_query($query_publications) or die(mysql_error());  
        
$num_rows_publication mysql_num_rows($result_publication); 
        
header_search_results(); 
        
$count 0;

               for(
$i=0$i<$num_rows_publication$i++)  
            {  
                
$count++;
                echo (
"<p>" mysql_result($result_publication$i"pubName") . "<a id='displayText".$count."' href='javascript:toggle(".$count.");'> Show Available Languages</a></p>"); 
          
                  
                
$query_files "SELECT * FROM files WHERE pubId = " .   
                
mysql_result($result_publication$i"id") . " ORDER BY files.language";  
                          
                        
$result_languages mysql_query($query_files) or die(mysql_error());   
                          
                        
$num_rows_languages mysql_num_rows($result_languages);  
                         echo(
"<div id='toggleText".$count."' style='display:none'>");  
                        for(
$j=0$j<$num_rows_languages;$j++)  
                        {                  
                             
                            echo(
"<table>");                          
                            echo(
"<tr><td class='language'> 
                            <a href='" 
mysql_result($result_languages$j"file") . "'>" mysql_result($result_languages$j"language") . "</a></td></tr>");  
                            echo(
"</table>");  
                              
                        }  
                         echo(
"</div>"); 
                echo(
"<hr/>");  
            }   


    } 
__________________
Izzmo
Coding Guru Extraordinaire
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline   Reply With Quote