Questo è l'errore che mi viene segnalato:
Proprio non capisco dove sia l'errore visto che mi sto basando su listati che avevo usato per un altro blog, senza problemi.Errore nella queryYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mod,admin) VALUES ('Giovanni','Pili','sytry82','sytry82@gmail.com',' 123456'' at line 1
Così, su due piedi, sospetto che il problema sia nel modo in cui ho realizzato la tabella; vi inserisco direttamente uno screenshot di phpmyadmin, relativo alla tabella "utenti":Codice PHP:<?php
if(!isset($_POST['submit'])){
echo('
<form method="post" action="#">
<table width="600px;">
<tr>
<td>Nome</td>
<td>Cognome</td>
<td>Nikname</td>
<td>eMail</td>
<td>Password</td>
</tr>
<tr>
<td><input type="text" name="nome"/></td>
<td><input type="text" name="cognome"/></td>
<td><input type="text" name="nikname"/></td>
<td><input type="text" name="email"/></td>
<td><input type="password" name="password"/></td>
</tr>
<tr>
<td colspan="5"><input type="submit" name="submit"/></td>
</tr>
</table>
</form>
');
}else{
include('blog/config.php');
$nome=mysql_real_escape_string($_POST['nome']);
$cognome=mysql_real_escape_string($_POST['cognome']);
$nikname=mysql_real_escape_string($_POST['nikname']);
$email=mysql_real_escape_string($_POST['email']);
$password=mysql_real_escape_string($_POST['password']);
$query="INSERT INTO utenti (nome,cognome,nikname,email,password,mod,admin) VALUES ('{$nome}','{$cognome}','{$nikname}','{$email}','{$password}','0','0')";
$result=@mysql_query($query, $conn->conn);
if(!$result)
{
die ("Errore nella query".mysql_error());
}else
{
header("Location:login_utente.php");
}
}
?>
Le colonne mod e admin le popolo con valore "0" in modo da poter fare una moderazione degli utenti che commentano e concedere l'accesso all'editor solo a certi utenti.
Cosa sto sbagliando?


Rispondi quotando