Ciao a tutti ... chi riesce a farmi capire cosa sbaglio ???

Sto facendo un semplicissimo motore di ricerca interno, e tutto funziona, il db è un db relazionale, e fuzniona perfettamente, il problema è nel printare il risultato ...

cerca.php
Codice PHP:
<form action='cerca.php?ricerca=ok' method='POST'>


  <input type='text' tabindex='15' name='cerca' class='input' size="15" >
  

  <input type="image" src="immagini/trova.gif"  value='Cerca'>

        </form>

</form>


       <?php

// connettiamoci il nostro database

include 'db_connect.php';

//connetto il database


// recuperiamo il valore ricerca inviato con get

$ricerca $_GET['ricerca'];

// vediamo se è stato inviato, e quindi uguale a ok

if ( $ricerca == 'ok' ) {

// recuperiamo ora cerca inviato con post

$cerca $_POST['cerca'];

// vediamo se è stato compilato il campo

if ( $cerca == TRUE && $cerca != "" ) {

// ora vediamo se supera i tre caratteri

if ( strlen($cerca) >= ) {

// ora depuriamo la stringa da cercare sul database 

$cerca =  mysql_escape_string(stripslashes($cerca)); 

// ora possiamo effettuare la nostra ricerca sul db, state attenti alla sintassi

$query "SELECT * FROM annunci WHERE titolo LIKE '%$cerca%' OR tipologia LIKE '%$cerca%'  "

$risultato mysql_query($query) or die (mysql_error()); 

$risposta mysql_query($query) or die ("Utilizza termini più specifici!");

$dentro_la_querymysql_fetch_assoc($risposta);

if ( 
$dentro_la_query == TRUE ) {

while(
$rowmysql_fetch_assoc($risultato)) { 

$id_annunci $row['id_annunci'];
$tipo $row['tipologia'];
$titolo $row['titolo'];

$ricerca $row['ricerca'];


// stampiamo i nostri dati







echo "<a href=\"rannunci.php?id=$id_annunci\"/><h2>$titolo</h2></a>
"




}

} else {

echo 
"Nessun temine alla ricerca trovato";

}


} else {

echo 
"Devi inserire almeno 3 caratteri";

}

} else {

echo 
"Non hai compilato il modulo ricerca";

}

}

?>
La pagina che deve restituire i risultati è :

rannunci.php

Codice PHP:
<?php

require ("db_connect.php"); 

$id_annunci=$_GET['id'];


$query mysql_query ("SELECT * FROM annunci 

        INNER JOIN cliente ON (annunci.clienteid=cliente.id) 
        INNER JOIN modello ON (annunci.modelloid=modello.id) 
        INNER JOIN risparmio ON (annunci.risparmioid=risparmio.id) 
        INNER JOIN catris ON (annunci.catrisid=catris.id) 
        INNER JOIN condizioni ON (annunci.condizioniid=condizioni.id) 
        INNER JOIN tipo ON (annunci.tipoid=tipo.id) 
        INNER JOIN notizie ON (annunci.notizieid=notizie.id )
        INNER JOIN categorie ON (annunci.categorieid=categorie.id)
        INNER JOIN users ON (annunci.user_id=users.id)  
        WHERE id_annunci=
$id_annunci LIMIT 1"); 


if (!
$query) {
  exit(
'

Error performing query: ' 
mysql_error() . '</p>');
}


while (
$row mysql_fetch_array($query)) {
$user_id $row ['id'];
$titolo $row ['titolo'];
$id_annunci $row ['id_annunci'];
$ts $row ['ts'];
$messaggio substr($row['messaggio'], 010000); 
$dotazione substr($row['dotazione'], 0500); 
$strumentazione substr($row['strumentazione'], 0500); 
  
$telefono substr($row['telefono'], 025); 
 
$modello $row ['modello'];
  
$mq $row ['mq'];
    
$locali $row ['locali'];
     
$prezzo $row ['prezzo'];
      
$tipologia $row ['tipologia'];
      
$tipo $row ['tipo'];
      
$altro $row ['altro'];
       
$condizioni $row ['condizioni'];
      
$name $row ['name']; 
  
$citta $row ['citta'];
  
$cliente $row ['cliente'];
  
$logo_cliente $row ['logo_cliente'];
  
$regione $row ['regione'];
   
$provincia $row ['provincia'];
    
$comune $row ['comune'];
      
$via $row ['via'];
       
$cap $row ['cap'];
       
$anno $row ['anno'];
        
$societa $row ['societa'];
 
$email $row ['email'];
 
$nome_file $row ['nome_file'];
  
$tipo_file $row ['tipo_file'];
  
$dati_file $row ['dati_file'];
 
$nome_file2 $row ['nome_file2'];
  
$tipo_file2 $row ['tipo_file2'];
  
$dati_file2 $row ['dati_file2'];
  
$nome_file3 $row ['nome_file3'];
  
$tipo_file3 $row ['tipo_file3'];
  
$dati_file3 $row ['dati_file3'];
  
$nome_file4 $row ['nome_file4'];
  
$tipo_file4 $row ['tipo_file4'];
  
$dati_file4 $row ['dati_file4'];
  
$nome_file5 $row ['nome_file5'];
  
$tipo_file5 $row ['tipo_file5'];
  
$dati_file5 $row ['dati_file5'];

?>
 qui printo i dati

    <td>
<?php echo "

<h2>[b]
$titolo</h2>[/b]</p>";?></td>
  </tr>
</table>
  
 
<table width="740" height="7">
  <tr>
    <td>
<?php echo "

[b] <h3>Data Articolo:  
$anno</h3>[/b]

<h3>[b]
$tipologia[/b]

</h3></p>"
;?></td>
  </tr>
  <tr>
    <td><?php echo "

<h4>[b]
$messaggio[/b]</h4></p>";?></td>
  </tr>
</table>


<table width="734">
  <tr>
    <td width="726" align="left" ><?php echo "

<h4>[b] Riferimento annuncio:  Obbligazioni 
$id_annunci[/b]</h4></p>";?></td>
  </tr>
</table>


<font color="FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Note: Copia e incolla la parte [ Obbligazioni xxx ] nella form per avere una risposta immediata al tuo annuncio. </font>


<hr />



<table width="100%">
  <tr>
    <td align="center" valign="middle"><?php require "728x90-1.php" ?></td>
  </tr>
</table>

<table width="705">
  <tr>
Il problema è nella JOIN, se io printo i dati come nelle pagine e quindi con una pagina rannunci_obb ecc ecc come da codice che segue tutto bene !!!

Codice PHP:
<?php

require ("db_connect.php"); 

$id_annunci=$_GET['id'];

/// query originale ///

$query mysql_query ("SELECT * FROM
   annunci INNER JOIN condizioni ON (annunci.condizioniid=condizioni.id) 
        INNER JOIN tipo ON (annunci.tipoid=tipo.id) 
      INNER JOIN users ON (annunci.user_id=users.id)  
       WHERE id_annunci=
$id_annunci LIMIT 1"); 


if (!
$query) {
  exit(
'

Error performing query: ' 
mysql_error() . '</p>');
}


while (
$row mysql_fetch_array($query)) {
$user_id $row ['id'];
$titolo $row ['titolo'];
$id_annunci $row ['id_annunci'];
$ts $row ['ts'];
$messaggio substr($row['messaggio'], 010000); 
$dotazione substr($row['dotazione'], 0500); 
$strumentazione substr($row['strumentazione'], 0500); 
  
$telefono substr($row['telefono'], 025); 
 
$modello $row ['modello'];
  
$mq $row ['mq'];
    
$locali $row ['locali'];
     
$prezzo $row ['prezzo'];
      
$tipologia $row ['tipologia'];
      
$tipo $row ['tipo'];
      
$altro $row ['altro'];
       
$condizioni $row ['condizioni'];
      
$name $row ['name']; 
  
$citta $row ['citta'];
  
$cliente $row ['cliente'];
  
$logo_cliente $row ['logo_cliente'];
  
$regione $row ['regione'];
   
$provincia $row ['provincia'];
    
$comune $row ['comune'];
      
$via $row ['via'];
       
$cap $row ['cap'];
       
$anno $row ['anno'];
        
$societa $row ['societa'];
 
$email $row ['email'];
 
$nome_file $row ['nome_file'];
  
$tipo_file $row ['tipo_file'];
  
$dati_file $row ['dati_file'];
 
$nome_file2 $row ['nome_file2'];
  
$tipo_file2 $row ['tipo_file2'];
  
$dati_file2 $row ['dati_file2'];
  
$nome_file3 $row ['nome_file3'];
  
$tipo_file3 $row ['tipo_file3'];
  
$dati_file3 $row ['dati_file3'];
  
$nome_file4 $row ['nome_file4'];
  
$tipo_file4 $row ['tipo_file4'];
  
$dati_file4 $row ['dati_file4'];
  
$nome_file5 $row ['nome_file5'];
  
$tipo_file5 $row ['tipo_file5'];
  
$dati_file5 $row ['dati_file5'];

?>
se aggiungo le altre JOIN per avere la possibilità di printare i risutati con un'unica pagina non mi printa i dati ( pero' mi prende l'id dell'annuncio ) che cosa sbaglio ????

Grazie