Mi scuso per l'inconveniente e faccio mea culpa.
Ho evidentemente sbagliato sezione inquanto mi sono reso conto che il problema ha a che fare con il codice php.
Continuo la discussione lasciando ad un moderatore il compito di spostarla:
nel valore
echo $r['nome_tabella'] "...."
non stampa un bel niente (apparte la successione dei puntini)
ho provato a sostituire cosi
echo $r['nome_tabella'] "$search"
ed ancora niente
ho provato a sostituire con
print_r ($row)
ed ho ottenuto la stampa ma in maniera tutt'altro che aulica.
Array ( [Autore] => al gore [Titolo] => la terra in bilico le battaglie per l�ambiente del vicepresidente usa )
Vi allego il codice:
Codice PHP:
<? $connection = mysql_connect('nome_host', 'nome_db', 'password') or die(mysql_error()); // Creates a new connection to the mysql server. mysql_select_db('db'); // Connects to the database. if(!isset($_POST['search'])){ // If the form has not been submitted. ?> <form method="POST"> Cerca: <input type="text" name="term" id="term" /> <input type="submit" name="search" id="search" value="Cerca" /> </form> <? }elseif(isset($_POST['search'])){ // ElseIf the form has been submitted. $term = addslashes($_POST['term']); // This is our search term, has a little sql injection protection with addslashes. $search = mysql_query("SELECT * FROM libri WHERE Autore LIKE '%$term%' OR Titolo LIKE '%$term'" ); // Using the LIKE syntax we can look in a database for a best match for the input, also the % work as wild cards. $total = mysql_num_rows($search); // Counts the total results found. if($total == 0){ // If the total is equal to 0 that means no results have been found. echo 'Nessun risultato trovato '; // Lets the user know nothing has been found! }else{ // Else there is results. while ($row = mysql_fetch_assoc($search)){ // This will loop through each row found and return the title of the tutorial. print_r ($row); } // End While. } // End Else. } // End ElseIf. ?>
Grazie e scusate ancora.