Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

Ayuda!! Problemas con PHP y MySQL

Estas en el tema de Ayuda!! Problemas con PHP y MySQL en el foro de Mysql en Foros del Web. Hola todos, les comento que soy nuevo en esto y estoy armando un pagina web simple para una inmobiliaria con php y MySQL(phpMyAdmin - 2.11.9.5) ...
  #1 (permalink)  
Antiguo 06/02/2010, 10:24
 
Fecha de Ingreso: febrero-2010
Mensajes: 2
Antigüedad: 14 años, 2 meses
Puntos: 0
Ayuda!! Problemas con PHP y MySQL

Hola todos, les comento que soy nuevo en esto y estoy armando un pagina web simple para una inmobiliaria con php y MySQL(phpMyAdmin - 2.11.9.5) y la verdad que necesito un poco de ayuda con eso porque estoy teniendo un par de problemas.
Bueno les comento un poco, estoy armando la parte del administrador cargue por la web en una base de datos todos los inmuebles que tiene y a su vez que pueda editar cada uno de ellos que agrego.
Bueno por el momento cree una parte principal donde seloguea el adm y luego puede ver un menu simple y todo los datos cargados ya en la base. Y la otra pagina cuando va a la opcion Agregar del menu, en esta le aparecera un formulario donde lo complata y se guarda en la base de datos.

Bueno el problema es que en la pagina principal no me aparecen mas de 3 datos cargados en la base de datos, no se bien cual es el problema, osea cuando agrego en el formulario algun inmuebles me los guarda pero maximo 3, muy rarooo!!!
entonces probe de otra manera, cargue manualmente otros inmuebles en la base de datos por el servidor y en la pagina principal solo me muestra 3!!! asi q probe una variantes de cosas y la verdad q no se es......
Espero que me puedan ayudar a resolver esto y se los agradeceria muchooo!!

Codigo de la pagina principal:
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
<!--
#Layer1 {
	position:absolute;
	left:51px;
	top:46px;
	width:493px;
	height:244px;
	z-index:1;
}
.Estilo1 {color: #FF0000}
.Estilo2 {font-size: medium}
.Estilo3 {font-size: 14px}
.Estilo4 {color: #FF0000; font-size: 12px; }
.Estilo5 {font-size: 12px}
-->
</style>
</head>
<body>
<div id="Layer1">
  <div align="center">
      <?php
	$contador=1;
	if(($_GET["formlogin"]=="1")&& $_REQUEST["user"]="administrator" && $_REQUEST["password"]="12345678a" ) {
	?>
      <!-- Direcciona a la Pagina de administrador -->
      <!--<script type="text/javascript">document.location.href='database.php'</script> -->
			<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
			<html xmlns="http://www.w3.org/1999/xhtml">
			<head>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<title>Administrador</title> 
			<style type="text/css">
			<!--
			.Estilo3 {font-size: xx-small}
			-->
			</style>
			</head>
			<body>
				<?php
			//Conectamos con la base de datos "basededatos"
			mysql_connect('localhost','user','clave); // usuario 
			mysql_select_db('basededatos'); //Base De Datos
			//Hacemos una consulta en la tabla inmobiliaria
			$result = mysql_query ("SELECT * FROM inmobiliaria");
			?>
			  <table width="400" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="#333333">
				  <tr>
					<th scope="col"><a href="database.php">Agregar</a></th>
					<th scope="col">Modificar</th>
					<th scope="col">Eliminar</th>
					<th scope="col">Informacion</th>
					<th scope="col">Ayuda</th>
				  </tr>
             </table>
<br />
              <br />
              <br />              
              <table width="1600px" border="1" align="left" cellpadding="0" cellspacing="0" bordercolor="#FFFF00">
				<tr>
				  <th width="100" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">ID</p></th>
				  <th width="80" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">OPERACION</p></th>
				  <th width="80" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">INMUEBLE</p></th>
				  <th width="80" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">AMBIENTES</p></th>
				  <th width="80" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">SUPERFICIE</p></th>
				  <th width="40" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">JARDIN</p></th>
				  <th width="50" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">COCHERA</p></th>
				  <th width="50" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">TERRAZA</p></th>
				  <th width="40" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">PILETA</p></th>
				  <th width="40" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">BANIOS</p></th>
				  <th width="50" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">COCINA</p></th>
				  <th width="80" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">PROVINCIA</p></th>
				  <th width="100" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">LOCALIDAD</p></th>
				  <th width="100" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">BARRIO</p></th>
				  <th width="140" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">DIRECCION</p></th>
				  <th width="300" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">DESCRIPCION</p></th>
				  <th width="100" bgcolor="#CCCCCC" scope="col"><p class="Estilo3">PRECIO</p></th>
				  <th bgcolor="#CCCCCC" scope="col"><p class="Estilo3"></p></th>
				  <th bgcolor="#CCCCCC" scope="col"><p class="Estilo3"></p></th>
				  <th bgcolor="#CCCCCC" scope="col"><p class="Estilo3"></p></th>
				</tr>
				
			 <?php
			 do {
			 ?>
			  <tr>
				  <table width="1600px" border="1" cellspacing="0" cellpadding="0" id="datos_inmobiliaria">
				   <tr>
					  <th width="100" scope="col" height="7"><p class="Estilo3"><?=$row ['idprop'] ?></p></th>
					  <th width="80"  scope="col"><p class="Estilo3"><?=$row ['operacion'] ?></p></th>
					  <th width="80"  scope="col"><p class="Estilo3"><?=$row ['inmueble']?></p></th>
					  <th width="80"  scope="col"><p class="Estilo3"><?=$row ['precio']?></p></th>
					  <th width="80"  scope="col"><p class="Estilo3">SUPERFICIE</p></th>
					  <th width="40"  scope="col"><p class="Estilo3">JARDIN</p></th>
					  <th width="50"  scope="col"><p class="Estilo3">COCHERA</p></th>
					  <th width="50"  scope="col"><p class="Estilo3">TERRAZA</p></th>
					  <th width="40"  scope="col"><p class="Estilo3">PILETA</p></th>
					  <th width="40"  scope="col"><p class="Estilo3">BANIOS</p></th>
					  <th width="50"  scope="col"><p class="Estilo3">COCINA</p></th>
					  <th width="80"  scope="col"><p class="Estilo3">PROVINCIA</p></th>
					  <th width="100" scope="col"><p class="Estilo3">LOCALIDAD</p></th>
					  <th width="100" scope="col"><p class="Estilo3">BARRIO</p></th>
					  <th width="140" scope="col"><p class="Estilo3">DIRECCION</p></th>
					  <th width="300" scope="col"><p class="Estilo3 ">DESCRIPCION</p></th>
					  <th width="80"  scope="col"><p class="Estilo3"><?=$row ['precio']?></p></th>
					  <th  scope="col">&nbsp;</th>
					  <th  scope="col">&nbsp;</th>
					  <th  scope="col">&nbsp;</th>
				   </tr>
				  </table>
				  
			<?php
			}while ($row = @mysql_fetch_array ($result))
			?>
			  </tr>
</table>
			</form>
			
			<?php
			
			//Cierra la conexion con la base de datos
			mysql_close();
			?>
</body>
</html>      
      <?php
	
	}
	else 
	{ 
	?>
 <h1 class="Estilo2"><span class="Estilo1">INMOBILIARIA GUOGLIELMI</span><span class="Estilo1">ADMINISTRADOR</span>
      </h1>
      </h1>
  </h1>
  </div>
  <form id="forml1" name="form1" method="post" action="adm.php?formlogin=1" >
				<div align="center">
			    <input type="hidden" name="formlogin" id="formlogin" value="1">
		      	</div>
				<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <th width="140" scope="col"><div align="right"><span class="Estilo3"><span class="Estilo5"></span></span></div></th>
    <th scope="col"><p><span class="Estilo3"><span class="Estilo5"></span></span></p></th>
  </tr>
  <tr>
    <th width="140" scope="row"><div align="right" class="Estilo5">
      <p><span class="Estilo1">*</span>USUARIO:</p>
    </div></th>
    <td><p class="Estilo5">
      <label>
        <input name="user" type="text" id="user" size="45"/>
        </label>
    </p></td>
  </tr>
  <tr>
    <th width="140" scope="row"><div align="right"><span class="Estilo3"><span class="Estilo5"></span></span></div></th>
    <td><p><span class="Estilo3"><span class="Estilo5"></span></span></p></td>
  </tr>
  <tr>
    <th width="140" scope="row"><div align="right" class="Estilo5">
      <p><span class="Estilo1">*</span>CONTRASE&Ntilde;A:</p>
    </div></th>
    <td><p class="Estilo5">
      <input name="password" type="password" id="password" size="45"/>
    </p></td>
  </tr>
  <tr>
    <th colspan="2" scope="row"><div align="center" class="Estilo4">
      <p>*Completar ambos campos para ingresar correctamente. </p>
    </div></th>
    </tr>
  <tr>
    <th colspan="2" scope="row"><div align="center">
      <input type="submit" name="Submit" value="Ingresar" />
    </div></th>
    </tr>
</table>
  </form>
  <?php
  }
  ?>
</div>
</body>
</html>
  #2 (permalink)  
Antiguo 06/02/2010, 10:24
 
Fecha de Ingreso: febrero-2010
Mensajes: 2
Antigüedad: 14 años, 2 meses
Puntos: 0
Respuesta: Ayuda!! Problemas con PHP y MySQL

Me falto un pedazo! jeje

Es la pagina del la opcion Agregar del Menu:

Código:
</html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>


<style type="text/css">
<!--
.Estilo3 {font-size: xx-small}
-->
</style>
</head>
<body>
<p><em>Si desea cargar una nueva operacion, complete correctamente todos los campos. Gracias.</em></p>

<form  method="post" action="database.php?formulario=1"> 

	<div align="center">
			<input type="hidden" name="formulario" id="formulario" value="1" />
    </div>
  <table width="750" border="0" align="left" cellpadding="0" cellspacing="0" style="background-color:#FFFFCC">
  <tr>
      <th width="118" height="20" class="Estilo23" scope="col"><div align="right"><strong>Operacion:</strong></div></th>
      <th align="left" width="165" height="20" class="Estilo23" scope="col"><label><select name="operacion" id="operacion">
          <option selected>Seleccione</option>
          <option>Venta</option>
          <option>Alquiler</option>
          <option>Permuta</option>
          <option>Fondo de Comercio</option>
        </select>
      </label></th>
      <th width="189" height="20" scope="col"><div align="right"><strong>Patio/Jardin:</strong></div></th>
      <th width="228" height="20" scope="col"><div align="left"><input name="jardin" type="checkbox" id="jardin" value="checkboxjardin" />
      </div>
      </label></th>
    </tr>
    <tr>
      <th width="118" height="20" class="Estilo23" scope="row"><div align="right">Inmuebles:</div></th>
      <td width="165" height="20" class="Estilo23"><label>
        <select name="inmueble" id="inmueble">
          <option selected>Seleccione</option>
          <option>Departamento</option>
          <option>Casa</option>
          <option>Quinta</option>
          <option>Terreno y lote</option>
          <option>Oficina</option>
          <option>Cochera</option>
          <option>Campo</option>
          <option>Galpón</option>
          <option>Hotel</option>
          <option>Fondo de Comercio</option>
          <option>Local comercial</option>
          <option>Edificio, Deposito</option>
        </select>
      </label></td>
      <td height="20"><div align="right"><strong>Cochera:</strong></div></td>
      <td height="20"><label>
        <input name="cochera" type="checkbox" id="cochera" value="checkboxcochera" />
      </label></td>
    </tr>
    <tr>
      <th height="20" class="Estilo23" scope="row"><div align="right"><strong>Ambientes:</strong></div></th>
      <td height="20" class="Estilo23"><label>
        <select name="ambiente" id="ambiente">
          <option selected>Seleccione</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
		  <option>6</option>
		  <option>7</option>
          <option>8 o +</option>
        </select> </label></td>
      <td height="20"><div align="right"><strong>Terraza:</strong></div></td>
      <td height="20"><label>
        <input name="terraza" type="checkbox" id="terraza" value="checkboxterraza" />
      </label></td>
    <tr>
      <th height="20" scope="row"><div align="right">Superficie m2: </div></th>
      <td height="20"><label>
        <input name="superficie" type="text" id="superficie" value="0" maxlength="8" />
      </label></td>
      <td height="20"><div align="right"><strong>Pileta:</strong></div></td>
      <td height="20"><label>
        <input name="pileta" type="checkbox" id="pileta" value="checkboxpileta" />
        </label></td>
    </tr>
    <tr>
      <td width="118" height="20" class="Estilo23">&nbsp;</td>
      <td width="165" height="20" valign="bottom">&nbsp;</td>
      <td height="20"><div align="right"><strong>Banios:</strong></div></td>
      <td height="20"><label>
        <select name="baño" id="baño">
          <option selected="selected">Seleccione</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8 o +</option>
        </select>
      </label></td>
    </tr>
    <tr>
      <td width="118" height="20" class="Estilo23">&nbsp;</td>
      <td width="165" height="20" valign="bottom">&nbsp;</td>
      <td height="20"><div align="right"><strong>Cocina:</strong></div></td>
      <td height="20"><label>
        <select name="cocina" id="cocina">
          <option selected="selected">Seleccione</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
          <option>4</option>
          <option>5</option>
          <option>6</option>
          <option>7</option>
          <option>8 o +</option>
        </select>
      </label></td>
    </tr>
    <tr>
      <th width="118" height="20" class="Estilo23" scope="col"><div align="right"><strong>Provincia:</strong></div></th>
      <th width="165" height="20" valign="bottom" scope="col"><div align="left">
        <select name="provincia" id="provincia">
          <option>Buenos Aires</option>
          <br />
          </select>
      </div></th>
      <td height="20">&nbsp;</td>
      <td height="20">&nbsp;</td>
    </tr>
    <tr>
      <td width="118" height="20" class="Estilo23"><div align="right"><strong>Localidad:</strong></div></td>
      <td width="165" height="20" valign="bottom"><label>
        <select name="localidad" id="localidad">
          <option>-------------------------</option>
          <option>Capital Federal</option>
          <option>San isidro</option>
          <option>San Miguel</option>
          <option>Tigre</option>
        </select>
      </label></td>
      <td height="20">&nbsp;</td>
      <td height="20">&nbsp;</td>
    </tr>
    <tr>
      <td width="118" height="20" class="Estilo23"><div align="right"><strong>Área/Barrio:</strong></div></td>
      <td width="165" height="20" valign="bottom"><div align="left">
        <select name="barrio" id="barrio">
            <option>-------------------------</option>
            <option>Don Torcuato</option>
            <option>Pacheco</option>
          </select>
      </div></td>
      <td colspan="2" rowspan="3"><div align="left"><strong>Descripcion:</strong></div>
      <label>
      <textarea name="textarea" id="textarea" cols="50" rows="5"></textarea>
      </label></td>
    </tr>
    <tr>
      <th height="20" scope="row"><div align="right">Dirección: </div></th>
      <td height="20"><label>
        <input name="direccion" type="text" id="direccion" maxlength="20" />
      </label></td>
    </tr>
    <tr>
      <th height="20" scope="row"><div align="right">Precio en U$S: </div></th>
      <td height="20"><label>
        <input name="precio" type="text" id="precio" value="0" maxlength="8" />
      </label></td>
    </tr>
    <tr>
      <th height="50" scope="row">&nbsp;</th>
      <td height="50"><input name="load" type="submit" id="load" value="Cargar" /> <label>
        <input name="reset" type="reset" id="reset" value="Restablecer" />
      </label></td>
      <td height="50">&nbsp;</td>
      <td height="50">&nbsp;</td>
    </tr>
  </table>
</form>
<br /> 
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
<br />
<form>
  <p>
    <?php

//Conectamos con la base de datos "basededatos"
mysql_connect('localhost','user','clave'); // usuario 
mysql_select_db('basedatos'); //Base De Datos

if(($_GET["formulario"]=="1") && (!empty($_REQUEST["textarea"]))) {

$operacion = $_POST["operacion"];
$inmueble = $_POST["inmueble"];
$superficie= $_POST["superficie"];
$provincia= $_POST["provincia"];
$localidad= $_POST["localidad"];
$barrio= $_POST["barrio"];
$direccion= $_POST["direccion"];
$jardin= $_POST["jardin"];
$cochera= $_POST["cochera"];
$terraza= $_POST["terraza"];
$pileta= $_POST["pileta"];
$banios= $_POST["banios"];
$cocina= $_POST["cocina"];
$descripcion= $_POST["descripcion"];
$precio = $_POST["precio"];

mysql_query ("INSERT INTO inmobiliaria (operacion, inmueble, ambientes, superficie,descripcion, precio)
VALUES ('$operacion', '$inmueble', $ambientes', '$superficie', '$descripcion', 'precio')"); 
//solo coloco algunas variables para probar

?>
<script type="text/javascript">document.location.href='adm.php?formlogin=1'</script>
<?php

}
?>

  </tr>
	</table>
</form>

<?php

//Cierra la conexion con la base de datos
mysql_close();

?>

</body>
</html>
Saludos,
Marcos

Etiquetas: php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:00.