Joomla.it Forum
Joomla! 3 => Joomla! 3 => : danielemontesi 17 Sep 2013, 13:08:19
-
Ciao a tutti..premetto che non sono esperto..ho realizzato una tabella in php utilizzando il plugin DirectPHP..funziona..perņ il footer del template viene posizionato sopra la tabella (vedi immagine)
(http://montesidaniele.altervista.org/screen.png)
Il codice č questo:
<?php
require_once JPATH_SITE.'/includes/php/user.php';
require_once JPATH_SITE.'/includes/php/dbConnection.php';
if (isset($_REQUEST["submit"])){
$selected = $_REQUEST['ric'];
$ricerca = null;
$valore = null;
if ($selected == 'cognome') {
$ricerca = "COGNOME";
$valore = $_REQUEST['cognome'];
}
else if ($selected == 'nome') {
$ricerca = "NOME";
$valore = $_REQUEST['nome'];
}
$tabella = getUsername();
$sql_str = "SELECT * FROM " . $tabella . " WHERE " . $ricerca . " LIKE '" . $valore ."%'";
$query = mysql_query($sql_str, $conn) or die ("Errore nella query");
if ($riga = mysql_fetch_array($query)){
$query = mysql_query($sql_str, $conn) or die ("Errore nella query");
echo "<table width = 100% border = 1 cellpadding = 2 cellspacing = 2>";
echo "<tr>";
echo "<td></td>";
echo "<td>Cognome</td>";
echo "<td>Nome</td>";
echo "<td>Data di nascita</td>";
echo "</tr>";
while ($riga = mysql_fetch_array($query)){
echo "<tr>";
echo "<td>";
echo "<a href='modifica.php?id=".$riga["IdIscritto"]."'>Modifica[/url] ";
echo "<a href='elimina.php?id=".$riga["IdIscritto"]."'>Elimina[/url] ";
echo "</td>";
echo "<td>" . $riga['Cognome'] . "</td>";
echo "<td>" . $riga['Nome'] . "</td>";
echo "<td>" . $riga['DataNascita'] . "</td>";
echo "</tr>";
}
}
mysql_close($conn);
}
?>
-
trovato l'errore..mancava la chiusura della tabella