Cia a tutti ho un problema e confido in voi per risolverlo ho creato all'interno del database di default di altervista delle tabelle ed ho anche inserito dei dati per provare a visualizzarli cercandoli nella mia search box però riscontro sempre questo errore...:
Notice: Undefined index: id in /membri/bigliettinofree/sql.php on line 4
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Questo è il codice che ho utilizzato per creare le tabelle:
Questo è quello che ho utilizzato per il file di conessione al databasecodice:CREATE TABLE IF NOT EXISTS `Temi Storici` ( `id` varchar(250) NOT NULL, `Argomento` varchar(250) NOT NULL, `Personaggio Storico` varchar(250) NOT NULL, `Testo` varchar(250) NOT NULL, KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Ed infine questo è il file sql.php quello che ho capito essere fondamentale per la riuscita dell'operazioneCodice PHP:<?php error_reporting(E_ALL); $host = "localhost"; $user = "bigliettinofree"; $pass = "*********"; $dbname = "my_bigliettinofree"; $conn = mysql_connect($host, $user, $pass) or die('Impossibile stabilire una connessione'); mysql_select_db($dbname); ?>
codice:<?php include_once("config.php"); $query_my_bigliettinofree = "SELECT * FROM my_bigliettinofree where titolo =". $_REQUEST['id'].""; $my_bigliettinofree = mysql_query($query_my_bigliettinofree, $conn) or die(mysql_error()); $row_my_bigliettinofree = mysql_fetch_assoc($my_bigliettinofree); $totalRows_my_bigliettinofree = mysql_num_rows($my_bigliettinofree); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Ricerca Appunti</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="300px" class="table" cellpadding="3" cellspacing="3 align="center"> <tr> <td>Titolo</td> <td>Testo</td> </tr> <?php do { ?> <tr> <td><?php echo $row_my_bigliettinofree['titolo']; ?></td> <td><?php echo $row_my_bigliettinofree['testo']; ?></td> </tr> <?php } while ($row_my_bigliettinofree= mysql_fetch_assoc($my_bigliettinofree)); ?> </table> </body> </html>
P.s: se dovesse servire quello utilizzato per creare la barra della ricerca è allegato.

Rispondi quotando
