Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/02/2013, 11:43
lramirez
 
Fecha de Ingreso: febrero-2013
Mensajes: 66
Antigüedad: 11 años, 3 meses
Puntos: 1
Información problema en toma de decisión

Saludos tengo en problema con este código necesito que en caso de que en la consulta no encuentre el dato los mande a otra agina lo he intentado colocando un header('Location: datos.php'); pero al parecer ignora esa instrucción gracias
Código PHP:
Ver original
  1. <title> datos</title>
  2. <form method="post" action="actualia.php">
  3. <table width="200" border="0" align="center" cellspacing="0">
  4.   <tr>
  5.     <td height="148"><img src="log[1].jpg" width="150" height="133" /></td>
  6.     <td><img src="CABESERA.png" width="801" height="144" /></td>
  7.   </tr>
  8. </table>
  9. <?php
  10. //Conexi贸n con el servidor
  11. $con=mysql_connect("localhost","root","");
  12.    if (!$con){die('ERROR DE CONEXION CON MYSQL:'. mysql_error());}
  13. /********* CONECTA CON LA BASE DE DATOS  **************** */
  14. $database = mysql_select_db("aaaaa",$con);
  15. if (!$database){die('ERROR CONEXION CON BD:'.mysql_error());}  
  16. /* ****************************************************** */
  17. //ejecutamos la consulta
  18.             $SQL="Select*From DATOSFISCALES WHERE RFC='".$_POST['rfc']."'";
  19. $result = mysql_query ($SQL);
  20. // verificamos que no haya error
  21. if (! $result){
  22.    header('Location:  datos.php');
  23. exit();
  24. }else {
  25.     echo "<table width='600' border='0' align='center'>
  26. <tr><td><h3><font color='red'>SI SUS DATOS SON INCORRECTOS MODIFIQUE AHORA </td></h3></tr></font>
  27.  </table>
  28.     </tr>";
  29. echo "<table width='150' border='0' align='left'>
  30. <tr>
  31. </td>
  32. <tr>
  33.     <tr><td>RFC</td>  </tr>
  34.     <tr><td>NOMBRE</td>  </tr>
  35.     <tr><td>CALLE</td>  </tr>
  36.     <tr><td>NO EXTERIOR</td>  </tr>
  37.     <tr><td>NO INTERIOR</td>  </tr>  
  38.     <tr><td>CODIGO POSTAL</td>  </tr>
  39.     <tr><td>COLONIA</td>  </tr>
  40.     <tr><td>POBLACION</td>  </tr>
  41.     <tr><td>PAIS</td>  </tr>
  42.     <tr><td>E-mail</td>  </tr>
  43.    </table>
  44.     </tr>";
  45. //obtenemos los datos resultado de la consulta
  46.  
  47.     while ($row = mysql_fetch_row($result))
  48.     {
  49. echo "<input type=text name=RFC      size=50 value=".$row[1]."><br>";
  50. echo "<textarea rows=1 cols=39 name=nombre >".$row[2]."</textarea><br>";
  51. echo "<input type=text name=calle    size=50 value=".$row[3]."><br>";
  52. echo "<input type=text name=exterior size=50 value=".$row[4]."><br>";
  53. echo "<input type=text name=interior size=50 value=".$row[5]."><br>";
  54. echo "<input type=text name=codigo   size=50 value=".$row[6]."><br>";
  55. echo "<input type=text name=colonia  size=50 value=".$row[7]."><br>";  
  56. echo "<input type=text name=estado   size=50 value=".$row[8]."><br>";
  57. echo "<input type=text name=pais     size=50 value=".$row[10]."><br>";
  58. echo "<input type=text name=email    size=50 value=".$row[11]."><br>";
  59.     }
  60.     }
  61. ?>
  62. <p><input type="submit" name="guardar" value=" Guardar "><br>
  63. </p>
  64. </form>