Eroare Error: Unknown column in field list
Scris: Lun Oct 31, 2011
INSERT.PHP
FORMULAR.PHP
Unde am gresit?cand dau run imi zice Error: Unknown column 'nrtel' in 'field list'
daca sterg <input type="text" name="nrtel"/>
imi da eroarea Date POST ne primite
Cod: Selectaţi tot
<?php
$con = mysql_connect("localhost","root","250644");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("anunturi", $con);
if(isset($_POST['titluanunt']) && isset($_POST['nume']) && isset($_POST['categorie']) && isset($_POST['sunteti']) && isset($_POST['textanunt']) && isset($_POST['pret']) && isset($_POST['moneda']) && isset($_POST['email']) && isset($_POST['nrtel']) && isset($_POST['judet']) && isset($_POST['localitate'])) {
$sql="INSERT INTO anunturi (titluanunt, nume, categorie, sunteti, textanunt, pret, moneda, email, nrtel, judet, localitate)
VALUES
('".$_POST['titluanunt']."','".$_POST['nume']."','".$_POST['categorie']."','".$_POST['sunteti']."','".$_POST['textanunt']."','".$_POST['pret']."','".$_POST['moneda']."','".$_POST['email']."','".$_POST['nrtel']."','".$_POST['judet']."','".$_POST['localitate']."')";
if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }
echo "1 record added";
}
else echo 'Date POST ne primite';
mysql_close($con);
?>
Cod: Selectaţi tot
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #CC0000}
-->
</style>
</head>
<body>
<table width="94%" border="1" align="center">
<form action="insert.php" method="post" enctype="multipart/form-data">
<tr>
<td width="16%"><div align="right">Nume de contact: </div></td>
<td colspan="6"><input type="text" name="nume" />
Sunteti:
<input type="radio" name="sunteti" value="Persoana" />
Persoana
<input type="radio" name="sunteti" value="Companie" />
Companie
<label></label> </td>
</tr>
<tr>
<td><div align="right">Categorie Anunt: </div></td>
<td colspan="6"><select name="categorie">
<option value="Afaceri">Afaceri</option>
<option value="Articole">Articole</option>
<option value="Animale">Animale</option>
<option value="Anticariat">Anticariat</option>
<option value="Arta-Antichitati">Arta si Antichitati</option>
<option value="Auto">Auto</option>
<option value="Calculatoare">Calculatoare</option>
<option value="Colectii">Colectii</option>
<option value="Constructii">Constructii</option>
<option value="Diverse">Diverse</option>
<option value="Donatii">Donatii</option>
<option value="Electrice">Electrice</option>
<option value="Foto">Foto</option>
<option value="Hobby">Hobby</option>
<option value="Imobiliare">Imobiliare</option>
<option value="Locuri-de-munca">Locuri de munca</option>
<option value="Moda">Moda</option>
<option value="Mobilier">Mobilier</option>
<option value="Moto-Velo">Moto Velo</option>
<option value="Media-Publicitate">Media Publicitate</option>
<option value="Muzica">Muzica</option>
<option value="Pierderi-Gasiri">Pierderi Gasiri</option>
<option value="Servicii">Servicii</option>
<option value="Sport">Sport</option>
<option value="Turism">Turism</option>
<option value="Telefoane">Telefoane</option>
</select> </td>
</tr>
<tr>
<td><div align="right">Titlu Anunt: </div></td>
<td colspan="6"><input type="text" name="titluanunt" maxlength="87" /> </td>
</tr>
<tr>
<td><div align="right">Text Anunt: </div></td>
<td colspan="6"><input type="text" name="textanunt" maxlength="255" /> </td>
</tr>
<tr>
<td><div align="right">Pret:</div></td>
<td width="19%"><input type="text" name="pret"/> </td>
<td width="11%">(<span class="style1">doar numere</span>) </td>
<td width="7%"><div align="right">Moneda:</div></td>
<td colspan="3"><select name="moneda">
<option value="RON">RON</option>
<option value="EUR">EUR</option>
<option value="USD">USD</option>
</select></td>
</tr>
<tr>
<td><div align="right">Adresa e-mail:</div></td>
<td colspan="6"><input type="text" name="email"/> </td>
</tr>
<tr>
<td><div align="right">Numar de telefon:</div></td>
<td colspan="6"><input type="text" name="nrtel"/> </td>
</tr>
<tr>
<td><div align="right">Judet:</div></td>
<td colspan="6"><select name="judet">
<option value="Alba">Alba</option>
<option value="Arad">Arad</option>
<option value="Arges">Arges</option>
<option value="Bacău">Bacău</option>
<option value="Bihor">Bihor</option>
<option value="Bistrita-Nasaud">Bistrita-Nasaud</option>
<option value="Botosani">Botosani</option>
<option value="Brăila">Brăila</option>
<option value="Brasov">Brasov</option>
<option value="Buzău">Buzău</option>
<option value="Călărasi">Călărasi</option>
<option value="Caras-Severin">Caras-Severin</option>
<option value="Cluj">Cluj</option>
<option value="Constanta">Constansa</option>
<option value="Covasna">Covasna</option>
<option value="Dâmbovita">Dâmbovita</option>
<option value="Dolj">Dolj</option>
<option value="Galati">Galati</option>
<option value="Giurgiu">Giurgiu</option>
<option value="Gorj">Gorj</option>
<option value="Harghita">Harghita</option>
<option value="Hunedoara">Hunedoara</option>
<option value="Ialomita">Ialomita</option>
<option value="Iasi">Iasi</option>
<option value="Ilfov">Ilfov</option>
<option value="Maramures">Maramures</option>
<option value="Mehedinti">Mehedinti</option>
<option value="Mures">Mures</option>
<option value="Neamt">Neamt</option>
<option value="Olt">Olt</option>
<option value="Prahova">Prahova</option>
<option value="Sălaj">Sălaj</option>
<option value="Satu Mare">Satu Mare</option>
<option value="Sibiu">Sibiu</option>
<option value="Suceava">Suceava</option>
<option value="Teleorman">Teleorman</option>
<option value="Timis">Timis</option>
<option value="Tulcea">Tulcea</option>
<option value="Vaslui">Vaslui</option>
<option value="Vâlcea">Vâlcea</option>
<option value="Vrancea">Vrancea</option>
</select> </td>
</tr>
<tr>
<td><div align="right">Localitate:</div></td>
<td colspan="6"><input type="text" name="localitate"/> </td>
</tr>
<tr>
<td><div align="right"></div></td>
<td colspan="6"><input type="submit" name="Submit" value="Submit" /> </td>
</tr>
</form>
</table>
</body>
</html>
daca sterg <input type="text" name="nrtel"/>
imi da eroarea Date POST ne primite