Jerry Schwartz escribió:
I don't see the form.
Unless one of your included files sets the values of your variables, this
code will insert a row of empty strings every time it executes.
Regards,
Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
-----Original Message-----
From: Marcelo Fabiani [mailto:[EMAIL PROTECTED]
Sent: Friday, September 01, 2006 1:06 PM
To: mysql@lists.mysql.com
Subject: help with insert +php
I'm trying to insert some data to my our web database, but when Insert
the data, it inserts all the data from my form and ads two rows with no
data.
Can someone tell me what I'm doing wrong?
Here is the code:
<?php
include 'config.php';
include 'opendb.php';
$sql="INSERT INTO empresas (nombreempresa, nomcontacto, nit,
direccion, ciudad, pais, telefonofijo, fax, email1, email2, web,
casilla, observaciones) VALUES
('$nombreempresa','$nombrecontacto','$nit','$direccion','$ciudad','$pais','$
telefono','$fax','$email1','$email2','$web','$casilla','$observaciones')";
mysql_query($sql) or die ("problema con query");
echo "<font color='#ff9a00'> Registro Insertado!!</font><br>";
$sq = "SELECT * FROM empresas";
$result = mysql_query($sq)or die ("problema Leyendo Tabla");;
echo "<table>";
echo "<tr><td>Nombre
Empresa</td><td>Nit</td><td>Direccion</td><td>Telefono</td></tr>";
while ($row=mysql_fetch_row($result)){
echo
"<tr><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[8]</td></tr>";
}
echo "</table>";
include 'closedb.php';
?>
Regards
Marcelo Fabiani
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
Yes here Is the part of the code of the form:
<map id="formu"><form method="post" action="insertar.php">
<div>
<label for="nombreempresa">Nombre Empresa: * </label>
<input name="nombreempresa" id="nombreempresa" size="35"
maxlength="100" type="text"> <acronym title="Campo Nombre Empresa: 100
carac. máx, sólo letras">?</acronym>
</div>
<div>
<label for="nombrecontacto">Nombre Contacto: * </label>
<input name="nombrecontacto" id="nombrecontacto" size="35"
maxlength="100" type="text"> <acronym title="Campo Nombre Empresa: 100
carac. máx, sólo letras">?</acronym>
</div>
<div><input name="add" id="add" value="Registro" type="submit"> <input
name="reset" id="reset" value="Limpiar" type="reset"></div>
</form></map>
Marcelo Fabiani
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]