RE: [PHP-DB] I have been trying to introduce data in a MySQL data base but I don't achieve it.

From: Date: Mon, 25 Mar 2002 20:56:57 +0000
Subject: RE: [PHP-DB] I have been trying to introduce data in a MySQL data base but I don't achieve it.
Groups: php.db 
Request: Send a blank email to php-db+get-17900@lists.php.net to get a copy of this message
First: what error are you getting? Second, make your code more readable and easier to debug: $query = "INSERT INTO usuario (USU_USUARIO, USU_CLAVE, USU_NOMBRE, USU_EMPRESA, USU_DIRECCION, USU_TELEFONO, USU_CIUDAD, USU_DEPARTAMENTO, USU_PAIS, USU_EMAIL, USU_REPCLAVE, USU_TIPCLIENTE)". VALUES ('$Cli_usuario','$Cli_Password1','$Cli_Nombre','$Cli_Empresa', ". "'$Cli_Direccion','$Cli_Telefono','$Cli_Ciudad','$Cli_Departamento','$Cli_Pa is','$Cli_Email','$Cli_RespClave', 'M')"; print $query; //do this to ensure you are sending the command you are expecting to send $result = mysql_query($query) or die("Error: ".mysql_error()); -----Original Message----- From: Sergio Cornejo [mailto:sercornejov@hotmail.com] Sent: Monday, March 25, 2002 2:29 PM To: php-db@lists.php.net Subject: [PHP-DB] I have been trying to introduce data in a MySQL database but I don't achieve it. Hi. I have been trying to introduce data in a MySQL database but I don't achieve it. I work with MySQL 3.23.47 for windows 98, Apache 1.3.23 for windows and PHP4. The form code: <form name="frm_Registro" method="post" action="tievir/regMay.php"> <table width="91%" border="0" name="tbl_login" bgcolor="#33CCFF"> <tr> <td width="18%" height="27"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Nombre:</font></td> <td height="27" colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" color="#000099"> <input type="text" name="Cli_Nombre" maxlength="50" size="50"> </font> </td> </tr> <tr> <td width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Empresa:</font></td> <td colspan="2"> <font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <font size="-1"> <input type="text" name="Cli_Empresa" maxlength="50" size="50"> <br> Si no pertenece a alguna empresa coloque &quot;Independiente&quot;</font></font></td> </tr> <tr> <td width="18%"> <p><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Direcci&oacute;n:</font></p> </td> <td colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Direccion" maxlength="60" size="60"></font></td> </tr> <tr> <td width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Tel&eacute;fono:</font></td> <td colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Telefono" maxlength="7" size="10"> </font></td> </tr> <tr> <td width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Ciudad:</font></td> <td colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Ciudad" maxlength="25" size="25"> </font></td> </tr> <tr> <td width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Departamento:</font></td> <td colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Departamento" maxlength="25" size="25"> </font></td> </tr> <tr> <td width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Pais:</font></td> <td colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Pais" maxlength="25" size="25"> </font></td> </tr> <tr> <td height="19" width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">e-mail:</font></td> <td height="19" colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Email" maxlength="60" size="60"> </font></td> </tr> <tr> <td height="19" width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Usuario:</font></td> <td height="19" width="16%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_Usuario" maxlength="15" size="17"> &nbsp;&nbsp;</font></td> <td height="19" width="66%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif" size="-1">Debe ser de m&iacute;nimo 8 y m&aacute;ximo 15 caracteres. Solo acepta caracteres entre la A..Z y n&uacute;meros del 0..9.</font></td> </tr> <tr> <td height="19" width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Password:</font></td> <td height="19"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="password" name="Cli_Password1" maxlength="8" size="10"> </font></td> <td height="19"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif" size="-1">Debe ser de m&iacute;nimo 5 y m&aacute;ximo 8 caracteres. Solo acepta caracteres entre la A..Z y n&uacute;meros del 0..9.</font></td> </tr> <tr> <td height="19" width="18%"> <p><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Confirmaci&oacute;n<br> del Password:</font></p> </td> <td height="19"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="password" name="Cli_Password2" maxlength="8" size="10"> </font></td> <td height="19"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif" size="-1">Vuelva a digitar el password exactamente igual que el anterior.</font></td> </tr> <tr> <td height="18" width="18%"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif">Respuesta Clave:</font></td> <td height="18" colspan="2"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif"> <input type="text" name="Cli_RespClave" maxlength="60" size="60"> <br> <font size="-1">Esta frase se le pedir&aacute; en caso de que olvide su password.</font></font></td> </tr> </table> <div align="center"><br> <input type="submit" name="btn_enviar" value="Enviar"> <input type="reset" name="btn_resetF" value="Borrar Formulario"> </div> </form> and the regMay.PHP code <html> <body> <? $link = mysql_connect("localhost", "indicol","159753"); mysql_select_db("telcellco", $link); $result=mysql_query("SELECT USU_USUARIO,USU_NOMBRE FROM USUARIO WHERE USU_USUARIO=$Cli_Usuario"); $existe=mysql_num_rows($result); if ($existe!=0) { if ($Cli_Nombre==mysql_result($result, 0, "USU_NOMBRE")) { fopen("../Cliexistente.htm") } else { fopen("../usuexistenteM.htm") } } else { if (mysql_query("INSERT INTO usuario (USU_USUARIO, USU_CLAVE, USU_NOMBRE, USU_EMPRESA, USU_DIRECCION, USU_TELEFONO, USU_CIUDAD, USU_DEPARTAMENTO, USU_PAIS, USU_EMAIL, USU_REPCLAVE, USU_TIPCLIENTE) VALUES ('$Cli_usuario','$Cli_Password1','$Cli_Nombre','$Cli_Empresa', '$Cli_Direccion','$Cli_Telefono','$Cli_Ciudad','$Cli_Departamento',' $Cli_Pais','$Cli_Email','$Cli_RespClave', 'M')",$link) or die("Couldn't insert data."); { fopen ("../respureg.htm") } else { fopen ("../ErrordesconocidoM.htm") } }; ?> </body> </html> I really give up. Would you be able to help me? Thank you Sergio Cornejo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#17900) next »