sono da pochi mesi che sto leggendo un liobro php mysql e sto creando un piccolo programma di contabilita' che ho in access .Ho un script php per selezionare le fatture rispetto ad un nome passato da un input type di una pagina html
ma mi da un errore ora posto tutto
questa e' lo script php
questa e' la pagina mostra il risultato sul tabellae questo e' l'errore
ma mi da un errore ora posto tutto
questa e' lo script php
PHP:
<?php
if (isset ($_POST["nome1"])){
$nome1 = $_POST["nome1"];
try{
include $_SERVER["DOCUMENT_ROOT"].'../includes/db.inc.php';
$sql = "SELECT * FROM registro WHERE 'descrizione' = $nome1";
$jokes = $pdo->query($sql);
$title="prima nota";
ob_start();
include '../../templates/fatture.html.php';
$output=ob_get_clean();
}
catch (PDOException $e) {
$title = 'An error has occurred';
$output = 'DAtabase error: ' . $e->getMessage() . ' in ' .
$e->getFile() . ':' . $e->getLine();
}
}
else {
$title = 'date riferimento';
ob_start();
include '../../templates/dateprimanota.html.php';
$output = ob_get_clean();
}
include "schemafatt.html.php";
"
questa e' la pagina html form che passa il nome
"
<form action="" method="post">
<label for="data">PRIMA DATA</label>
<input type name="nome1">
<input type="submit" value="cerca">
</form>
PHP:
<body>
<table border="1" cellspacing="4" cellpadding="4">
<tr>
<th>id</th>
<th>data</th>
<th>data pagamento</th>
<th>cod fornitore</th>
<th>descrizione</th>
<th>numero fattura</th>
<th>importo</th>
<th>cod spesa</th>
<th>metodo</th>
<th>numero assegno</th>
</tr>
<?php foreach($jokes as $joke): ?>
<tr>
<td align="center"><?($joke['id'])?></td>
<td align="center"><?=($joke['data'])?></td>
<td align="center"><?=($joke['data_pagamento'])?></td>
<td align="center"><?=($joke['cod_fornitore'])?></td>
<td align="center"><?=($joke['descrizione'])?></td>
<td align="center"><?=($joke['numero_fattura'])?></td>
<td align="center"><?=($joke['importo'])?></td>
<td align="center"><?=($joke['cod_spesa'])?></td>
<td align="center"><?=($joke['metodo'])?></td>
<td align="center"><?=($joke['numero_assegno'])?></td>
<td><form action="cancellafattura.php" method="post"></td>
<input type="hidden" name="id" value="<?=$joke['id']?>">
<td align="center"><input type="submit" value="Delete"></td></tr>
<?php endforeach; ?>
</form>
</table>
</body>
DAtabase error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'cocco' in 'where clause' in C:\xampp\htdocs\mio\fatture\dateprimanota.php:10
Ultima modifica di un moderatore: