Salve a tutti, sono davvero in difficoltà con questo script.
Lo script dovrebbe, in seguito all'inserimento dell'ID di una riga del Database, mostrarmi delle colonne specificate da me. Qui di seguito, lo script dove deve comparire il risultato della ricerca :
Codice PHP:
<?php
include "config.php";
$id=$_POST['id'];
echo "Risultati ricerca";
$sql = "SELECT entry FROM items WHERE entry $id";
$query = @mysql_query ($sql) or die (mysql_error());
while($row = mysql_fetch_row($query))
{
echo "Entry Nome Livello Min Costo /n";
echo ".$row[entry].-.$row[name1].-.$row[requiredlevel].-.$row[buyprice]./n/n";
}
session_destroy();
?>
qui il Form
Codice PHP:
<!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" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>Ricerca Oggetti - ID</title>
</head>
<body id="process">
<form name="form" action="risultato.php" method="POST">
<label for="login-username" class="registration-text">Entry/ID item:</label>
<input class="required-username" name="id" id="login-username" value="ID" type="text" />
<input type="submit" name="submit" value="Cerca" id="FormsButton1">
<div class="clear"></div>
</body>
</html>
chiedo aiuto, l'errore è questo:
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 '41120' at line 1
41120 è l'ID inserito tramite form