Código :
Warning: mysql_free_result(): 13 is not a valid MySQL result resource in C:\AppServ\www\Prueba\alta_usuario.php on line 154
Y el código es:
Código PHP :
<?php require_once('Connections/PruebaON.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO tblusuario (usuario, email, password, estado, direccion, localidad, provincia) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['usuario'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['password'], "text"), GetSQLValueString($_POST['estado'], "int"), GetSQLValueString($_POST['direccion'], "text"), GetSQLValueString($_POST['localidad'], "text"), GetSQLValueString($_POST['provincia'], "int")); mysql_select_db($database_PruebaON, $PruebaON); $Result1 = mysql_query($insertSQL, $PruebaON) or die(mysql_error()); $insertGoTo = "alta_ok.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_PruebaON, $PruebaON); $query_ConsultaProvincias = "SELECT * FROM tblprovincias ORDER BY tblprovincias.provincia"; $ConsultaProvincias = mysql_query($query_ConsultaProvincias, $PruebaON) or die(mysql_error()); $row_ConsultaProvincias = mysql_fetch_assoc($ConsultaProvincias); $totalRows_ConsultaProvincias = mysql_num_rows($ConsultaProvincias); ?> <!doctype html> <html><!-- InstanceBegin template="/Templates/principal.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta charset="iso-8859-1"> <title>PruebaPrueba</title> <link href="estilos/HTML5_twoColFixRtHdr.css" rel="stylesheet" type="text/css"> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <header></header> <div class="container"> <div class="sidebar1"> <div id="include"> <?php include("includes/accionesdeusuario.php")?> </div><br> <div id="include2"> <?php include("includes/categorias.php")?> </div><hr align="left" width="70%"> <div id="include3"> <?php include("includes/provincias.php")?> </div> </div> <article class="content"><!-- InstanceBeginEditable name="contenido" --> <section> <h2>Contenido</h2> </section> <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="contenido2" --> <section> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Usuario:</td> <td><input type="text" name="usuario" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Contraseña:</td> <td><input type="text" name="password" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Direccion:</td> <td><input type="text" name="direccion" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Localidad:</td> <td><input type="text" name="localidad" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Provincia:</td> <td><label for="provincia"></label> <select name="provincia" id="provincia"> <?php do { ?> <option value="<?php echo $row_ConsultaProvincias['idProvincia']?>"><?php echo $row_ConsultaProvincias['provincia']?></option> <?php } while ($row_ConsultaProvincias = mysql_fetch_assoc($ConsultaProvincias)); $rows = mysql_num_rows($ConsultaProvincias); if($rows > 0) { mysql_data_seek($ConsultaProvincias, 0); $row_ConsultaProvincias = mysql_fetch_assoc($ConsultaProvincias); } ?> </select></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="¡Registrate!"></td> </tr> </table> <input type="hidden" name="estado" value="1"> <input type="hidden" name="MM_insert" value="form1"> </form> </section> <!-- InstanceEndEditable --> <!-- end .content --></article> <!-- end .container --></div> </body> <!-- InstanceEnd --></html> <?php mysql_free_result($ConsultaProvincias); ?>