Come da titolo, ho strutturato il sito_prova cosi:

connect.php
codice:
<?php	
$user = 'root';
$password = 'root';
$db = 'nome_db';
$host = 'localhost';
$port = 3306;


$link = mysql_connect(
   "$host:$port", 
   $user, 
   $password
);
$db_selected = mysql_select_db(
   $db, 
   $link
);


?>
ins_db.php
codice:
<?	
	
$name = $_POST['name'];
$address = $_POST['address'];


$toinsert = "INSERT INTO anagrafica
			(name, address)
			VALUES
			('$name',
			'$address')";




$result = mysql_query($toinsert);	
if($result){
	echo("<br>Inserimento avvenuto correttamente");
} else{
	echo("<br>Inserimento non eseguito");
}


if (!mysql_query($query,$db)) {
echo mysql_error() ." attenzione, Impossibile inserire il record nel database";
} else { print ("record inserito con successo"); }


?>
index.php

codice:
<!DOCTYPE html><html>
<body>


<?php


require 'connect.php';


?>


<table border="0">
  <tr>
    <td align="center">Inserisci i dati richiesti</td>
  </tr>
  <tr>
    <td>
      <table>
        <form method="post" action="ins_db.php">
        <tr>
          <td>Nome</td>
          <td><input type="text" name="name" size="20">
          </td>
        </tr>
        <tr>
          <td>Indirizzo</td>
          <td><input type="text" name="address" size="40">
          </td>
        </tr>
        <tr>
          <td></td>
          <td align="right"><input type="submit" 
          name="submit" value="Sent"></td>
        </tr>
        </form>
        </table>
      </td>
    </tr>
</table>


</body>
</html>
Si collega correttamente ma se provo a caricare i dati mi stampa l'errore: Inserimento non eseguitoNo database selected attenzione, Impossibile inserire il record nel database

ma non l'ho già selezionato
nel connect.php???