Hello,

I'm doing a website about a music school, in this moment i'm working the list of instruments:

<?php
$username = "root";
$password = "";
$hostname = "localhost";
$database = "esola_musica";	

$connect = mysql_connect($hostname, $username, $password) or die("Erro na ligação à BD.");

mysql_select_db($database,$connect) or die(mysql_error());
$sql_imagem = "SELECT cod_curso, image_curso, nome_curso FROM curso ORDER BY nome_curso ASC";

$i=0;
echo "<table width = 90%  height = 45% align = center>";

$executa=mysql_query($sql_imagem,$connect); 

while($dados=mysql_fetch_array($executa))
{   
 $i+=1;   
 if ($i == 1)    
  {    
  echo "<tr> <td align = center>";   
  }  
  else   {    
   echo "<td align = center>";   
  }       
 
  echo "<a href='curso_guitarra.php'>";
  echo "<img src=\"".$dados['image_curso']."\"/> <br /> ".$dados['nome_curso'];
  echo "</a>";     
  if ($i == 4)   {   
   echo "</td> </tr>";
   $i=0;   
  }  
  else   {
    echo "</td>";
  }   
}

echo "</table>";
?>

what i want is to link the images to their respective study plan. Like, if i click on electric guitar it opens its study plan*.

*STUDY PLAN is what the students will learn in the instrument lessons

Recommended Answers

All 2 Replies

So... what's the problem?

when i put:
Code: [Select]

if ($dados [cod_curso] == 1){
echo "<a href='curso_guitarra.php'>";
echo "<img src=\"".$dados."\"/> <br /> ".$dados;
echo "</a>";}


only appears the guitar image.
What i want is to appears the complete table and when i click in the guitar image it opens other page with guitar information, got it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.