Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/01/2016, 20:19
byrong
 
Fecha de Ingreso: enero-2016
Ubicación: Venezuela
Mensajes: 139
Antigüedad: 8 años, 3 meses
Puntos: 3
Warning: mysql_fetch_array()

Buenas, me sale este error al entrar al index.php de mi página...

Notice: Undefined variable: re1 in C:\xampp\htdocs\index.php on line 42

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\index.php on line 42

En sí el formulario funciona bien, pero en el index me sale ese error...
Y para poder que al dar click a algún estado funcione el submit tuve que hacer un c
Acá esta el codigo y si tengo algún otro error por favor ayudenme...

Buenas, me sale este error al entrar al index.php de mi página...

Notice: Undefined variable: re1 in C:\xampp\htdocs\index.php on line 42

Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\index.php on line 42

En sí el formulario funciona bien, pero en el index me sale ese error...
Y para poder que al dar click a algún estado funcione el submit tuve que hacer un cuadro de texto ya que no se como hacer para que funcione que al darle click que si por ejemplo al Estado Trujillo me salga automáticamente la lista de los municipios...
Acá esta el codigo y si tengo algún otro error por favor ayúdenme...

Código:
$re=mysql_query("select * from estados");

		if(isset($_POST['estados'])){
			$estado=$_POST['estados'];
			$re1=mysql_query("select * from municipios where id_estado=".$estado."");
			$re2=mysql_query("select nombreestado from estados where id_estado=".$estado."");
			$j=mysql_fetch_array($re2);

		}else{
		@$j[nombreestado]='Seleccione su Estado'; }

		?>
		<form id="form1" name="form1" method="post" action="">
			Nombre Completo
			<input name="nombre" type="text" id="nombre" valor="<?php echo$_POST[nombre]?>"
			<br>
			<br>


		<select name="estados" size="1" id="estados" onchange="submit()" style="width:200px">
		<option value="0" selected="selected"><?php echo @$j[nombreestado];?></option>
		<?php

		while($f=mysql_fetch_array($re)){
		echo '<option value='.$f[id_estado].'>'.$f[nombreestado].'</option>';

		}
		?>
		<br>
		<select name="municipios" size="1" id="municipios" style="width:200px">
		<?php

		while($f1=mysql_fetch_array($re1)){
				echo'<option>'.$f1['nombremunicipio'].'</option>';
			}
			?>
Gracias..