elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Estamos en la red social de Mastodon


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Ayuda
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda  (Leído 1,663 veces)
ArhennJosey

Desconectado Desconectado

Mensajes: 35


Ver Perfil
Ayuda
« en: 7 Noviembre 2011, 15:04 pm »

Buen dia a todos, necesito, consultar los datos de una base en mysql y queal mismo tiempo me de la opcion de actualizarlos o eliminarlos perono se como hacerlo, alguien me puede ayudar, gracias. debe ser con php.
AYUDENME GRACIAS.


En línea

ArhennJosey

Desconectado Desconectado

Mensajes: 35


Ver Perfil
Re: Ayuda
« Respuesta #1 en: 7 Noviembre 2011, 17:29 pm »

la verdad estoy aprendiendo php y tengo este codigo para modificar datos de una base en mysql, perono me funciona, alguien me colaborar por favor. gracias.

<?php require_once('conectar.php');?>

<?php

$cedula=$_POST["cedula"];

$nombres=$_POST["nombres"];

$apellidos=$_POST["apellidos"];

$profesion=$_POST["profesion"];

$ciudad=$_POST["ciudad"];

$fechanaci=$_POST["fechanaci"];



echo " ".$nombre."<br><br>";



$nombre_archivo=$_FILES['userfile']['name'];

$destino = "cosas/".$nombre_archivo;

$tipo_archivo=$_FILES['userfile']['type'];

$tamano_archivo=$_FILES['userfile']['size'];



if(!((strpos($tipo_archivo,"gif")|| strpos($tipo_archivo,"jpeg")) && ($tamano_archivo <100000)))

{

   echo"la extensión o el tamaño de los archivos no es correcta.<br><br>

   <table><tr><td><li>Se permiten archivos.gif o jpg<br>

                  <li>se permiten archivos de 100 Kb maximo.</td></tr><table>";

}

    else

     {

   

        if(move_uploaded_file($_FILES['userfile']['tmp_name'], $destino))

         {

            echo "Los Datos han sido grabados correctamente";



       $sqlgraba="insert into datos(cedula,nombres,apellidos,profesion,ciudad,fechanaci,foto)

                       values('$cedula','$nombres','$apellidos','$profesion','$ciudad','$fechanaci','$destino')";

            $ejecutar=mysql_query($sqlgraba,$con);

         }

        else

         {

          echo "Ocurrio algun error al subir la imagen. No pudo guardarse.";

          }   

      }



?>
<html>

<head>

<title>Nacional de Resistencias</title>

<link rel="stylesheet" href="site.css" type="text/css">

<body>

<form method="post" action="datos.php" enctype="multipart/form-data"><br><br>

<table border="0" bordercolor="#cococo" cellspacing="0" width="100%" heigth="100%" bgcolor="#ffffff">

<tr><td>



<table  border="0" width="100%" heigth="10%">

<tr>

<td align="left"><img src="cosas/logo.jpg" width="170" height="130"></td>

<td align="center"><img src="cosas/404164.jpg" width="800" height="130"></td>

</tr>

</table>



<table>

 <TR>

     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="inicio.html">Inicio</a></TD>

     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="index.html">Quienes Somos</a></TD>

     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="index.html">Pedidos</a></TD>

     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="registro.html">Registro</a></TD>

     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="consultas.html">Consultas</a></TD>     

     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="index.html">Contactanos</a></TD>

 </TR>

</table>



<table border="0" bordercolor="#cococo" cellspacing="0" width="100%" heigth="70%" align="center">

<tr><td>

<table border="0" bordercolor="#cococo" cellspacing="0" width="15%" heigth="70%" align="left"><br>

<tr><td widht="60" heigth="22" bgcolor="#cococo" align="center">Menu</td></tr>

<td><br>

<table border="0" width="80%" heigth="75%" align="left">

<tr><td><a href="#">Link 1<br></a></td></tr>

<tr><td><a href="#">Link 2<br></a></td></tr>

<tr><td><a href="#">Link 3<br></a></td></tr>

<tr><td><a href="#">Link 4<br></br></a></td></tr><br>

</table>

<tr><td>

<!-- SOLUTIONSWEB --><br />

                        <center><iframe marginwidth="0" marginheight="0" src="http://www.free-blog-content.com/Calendars/calendar00061.htm" frameborder="no" width="162" scrolling="no" height="228" allowtransparency="allowtransparency">
</iframe></center><center><a style="font-size: 3mm" href="http://solutionsweb.es.tl/" _fcksavedurl="http://solutionsweb.es.tl/">SOLUTIONSWEB</a></center><br />

</td></tr>

</table>



<table border="0" bordercolor="#cococo" cellspacing="0" width="15%" heigth="70%" align="right" bordercolor="#cococo"><br>

<tr><td widht="60" heigth="22" bgcolor="#cococo" align="center">Siguenos</td></tr>

<tr><td><br><a target="_blank" href="http://www.facebook.com"><center><img border="0" src="cosas/facebook.jpg" width="90" height="90"></a><br>Facebook</center></td></tr>

<tr><td><a target="_blank" href="http://www.twitter.com"><center><img border="0" src="cosas/twitter.png" width="90" height="90"></a><br>Twitter</center></td></tr>

<tr><td><a target="_blank" href="http://www.myspace.com"><center><img border="0" src="cosas/myspace.jpg" width="90" height=90"></a><br>MySpace</center></td></tr>

</table>



 <br></br><table border="2" bordercolor="#cococo" cellspacing="0" width="45%" height="40%" align="center">

  <tr><td><center><br><h3>REGISTRO</h3></center>

    </br><table border="0" bordercolor="#cococo" align="center">

     

     

<tr><td>Numero de Identificacion :</td><td><input type="text" name="cedula"></td></tr>



<tr><td>Nombres:</td><td><input type="text" name="nombres"></td></tr>



<tr><td>Apellidos:</ttd><td><input type="text" name="apellidos"></td></tr>



<tr><td>Profesion:</td><td><input type="text" name="profesion"></td></tr>



<tr><td>Ciudad de Nacimiento</td><td><select name="ciudad" value="ciudad"size="1"maxlength="15">

    <center><option selected value="Barranquilla">Barranquilla</center><br>

    <center><option selected value="Bogota">Bogota</center><br>

    <center><option selected value="Cali">Cali</center><br>

   <center><option selected value="Cartagena">Cartagena</center><br>

   <center><option selected value="Neiva">Neiva</center><br>

    <center><option selected value="Popayan">Popayan</center>

   </select></td></tr>



<tr><td>Fecha Nacimiento:</td><td><input type="text" name="fechanaci"></td></tr>



<tr><td>Foto</td><td><input type="file" name="userfile"></td></tr>

</td></tr>

</table><br></br>

<center><input type="submit" value="ENVIAR"></center>

  </td></tr>

 </table>

</table>

</table>

</td></tr>

</table>

<table border="0" width="100%" heigth="10%" align="center" bgcolor="#ffffff">

 <tr>

  <td align="center">

   <a href="http://"><center><img border="0" src="cosas/cc.gif" width="150" height="30"><br>Acerca de Nosotros</a> |

   <a href="http://">Contactanos</a> |

   <a href="http://">Mapa del Sitio</a></center><br>

   <p>&copy 2002 Marca Registrada<br>

    <a href="http://www.nacionalderesistencias.com"><H4>http://www.nacionalderesistencias.com</H4></a>

  </td>

 </tr>

</table>

</body>

</html>


En línea

Pablo Videla


Desconectado Desconectado

Mensajes: 2.274



Ver Perfil WWW
Re: Ayuda
« Respuesta #2 en: 7 Noviembre 2011, 19:33 pm »

Usa el codigo geshi para que tu codigo se vea asi :

Código
  1.  
  2. <?php require_once('conectar.php');?>
  3.  
  4. <?php
  5.  
  6. $cedula=$_POST["cedula"];
  7.  
  8. $nombres=$_POST["nombres"];
  9.  
  10. $apellidos=$_POST["apellidos"];
  11.  
  12. $profesion=$_POST["profesion"];
  13.  
  14. $ciudad=$_POST["ciudad"];
  15.  
  16. $fechanaci=$_POST["fechanaci"];
  17.  
  18.  
  19.  
  20. echo " ".$nombre."<br><br>";
  21.  
  22.  
  23.  
  24. $nombre_archivo=$_FILES['userfile']['name'];
  25.  
  26. $destino = "cosas/".$nombre_archivo;
  27.  
  28. $tipo_archivo=$_FILES['userfile']['type'];
  29.  
  30. $tamano_archivo=$_FILES['userfile']['size'];
  31.  
  32.  
  33.  
  34. if(!((strpos($tipo_archivo,"gif")|| strpos($tipo_archivo,"jpeg")) && ($tamano_archivo <100000)))
  35.  
  36. {
  37.  
  38.   echo"la extensión o el tamaño de los archivos no es correcta.<br><br>
  39.  
  40.   <table><tr><td><li>Se permiten archivos.gif o jpg<br>
  41.  
  42.                  <li>se permiten archivos de 100 Kb maximo.</td></tr><table>";
  43.  
  44. }
  45.  
  46.    else
  47.  
  48.     {
  49.  
  50.  
  51.  
  52.        if(move_uploaded_file($_FILES['userfile']['tmp_name'], $destino))
  53.  
  54.         {
  55.  
  56.            echo "Los Datos han sido grabados correctamente";
  57.  
  58.  
  59.  
  60.       $sqlgraba="insert into datos(cedula,nombres,apellidos,profesion,ciudad,fechanaci,foto)
  61.  
  62.                       values('$cedula','$nombres','$apellidos','$profesion','$ciudad','$fechanaci','$destino')";
  63.  
  64.            $ejecutar=mysql_query($sqlgraba,$con);
  65.  
  66.         }
  67.  
  68.        else
  69.  
  70.         {
  71.  
  72.          echo "Ocurrio algun error al subir la imagen. No pudo guardarse.";
  73.  
  74.          }  
  75.  
  76.      }
  77.  
  78.  
  79.  
  80. ?>
  81. <html>
  82.  
  83. <head>
  84.  
  85. <title>Nacional de Resistencias</title>
  86.  
  87. <link rel="stylesheet" href="site.css" type="text/css">
  88.  
  89. <body>
  90.  
  91. <form method="post" action="datos.php" enctype="multipart/form-data"><br><br>
  92.  
  93. <table border="0" bordercolor="#cococo" cellspacing="0" width="100%" heigth="100%" bgcolor="#ffffff">
  94.  
  95. <tr><td>
  96.  
  97.  
  98.  
  99. <table  border="0" width="100%" heigth="10%">
  100.  
  101. <tr>
  102.  
  103. <td align="left"><img src="cosas/logo.jpg" width="170" height="130"></td>
  104.  
  105. <td align="center"><img src="cosas/404164.jpg" width="800" height="130"></td>
  106.  
  107. </tr>
  108.  
  109. </table>
  110.  
  111.  
  112.  
  113. <table>
  114.  
  115. <TR>
  116.  
  117.     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="inicio.html">Inicio</a></TD>
  118.  
  119.     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="index.html">Quienes Somos</a></TD>
  120.  
  121.     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="index.html">Pedidos</a></TD>
  122.  
  123.     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="registro.html">Registro</a></TD>
  124.  
  125.     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="consultas.html">Consultas</a></TD>    
  126.  
  127.     <TD WIDTH=160 HEIGHT=22 bgcolor="#C0C0C0" align="center"><a href="index.html">Contactanos</a></TD>
  128.  
  129. </TR>
  130.  
  131. </table>
  132.  
  133.  
  134.  
  135. <table border="0" bordercolor="#cococo" cellspacing="0" width="100%" heigth="70%" align="center">
  136.  
  137. <tr><td>
  138.  
  139. <table border="0" bordercolor="#cococo" cellspacing="0" width="15%" heigth="70%" align="left"><br>
  140.  
  141. <tr><td widht="60" heigth="22" bgcolor="#cococo" align="center">Menu</td></tr>
  142.  
  143. <td><br>
  144.  
  145. <table border="0" width="80%" heigth="75%" align="left">
  146.  
  147. <tr><td><a href="#">Link 1<br></a></td></tr>
  148.  
  149. <tr><td><a href="#">Link 2<br></a></td></tr>
  150.  
  151. <tr><td><a href="#">Link 3<br></a></td></tr>
  152.  
  153. <tr><td><a href="#">Link 4<br></br></a></td></tr><br>
  154.  
  155. </table>
  156.  
  157. <tr><td>
  158.  
  159. <!-- SOLUTIONSWEB --><br />
  160.  
  161.                        <center><iframe marginwidth="0" marginheight="0" src="http://www.free-blog-content.com/Calendars/calendar00061.htm" frameborder="no" width="162" scrolling="no" height="228" allowtransparency="allowtransparency">
  162. </iframe></center><center><a style="font-size: 3mm" href="http://solutionsweb.es.tl/" _fcksavedurl="http://solutionsweb.es.tl/">SOLUTIONSWEB</a></center><br />
  163.  
  164. </td></tr>
  165.  
  166. </table>
  167.  
  168.  
  169.  
  170. <table border="0" bordercolor="#cococo" cellspacing="0" width="15%" heigth="70%" align="right" bordercolor="#cococo"><br>
  171.  
  172. <tr><td widht="60" heigth="22" bgcolor="#cococo" align="center">Siguenos</td></tr>
  173.  
  174. <tr><td><br><a target="_blank" href="http://www.facebook.com"><center><img border="0" src="cosas/facebook.jpg" width="90" height="90"></a><br>Facebook</center></td></tr>
  175.  
  176. <tr><td><a target="_blank" href="http://www.twitter.com"><center><img border="0" src="cosas/twitter.png" width="90" height="90"></a><br>Twitter</center></td></tr>
  177.  
  178. <tr><td><a target="_blank" href="http://www.myspace.com"><center><img border="0" src="cosas/myspace.jpg" width="90" height=90"></a><br>MySpace</center></td></tr>
  179.  
  180. </table>
  181.  
  182.  
  183.  
  184. <br></br><table border="2" bordercolor="#cococo" cellspacing="0" width="45%" height="40%" align="center">
  185.  
  186.  <tr><td><center><br><h3>REGISTRO</h3></center>
  187.  
  188.    </br><table border="0" bordercolor="#cococo" align="center">
  189.  
  190.  
  191.  
  192.  
  193.  
  194. <tr><td>Numero de Identificacion :</td><td><input type="text" name="cedula"></td></tr>
  195.  
  196.  
  197.  
  198. <tr><td>Nombres:</td><td><input type="text" name="nombres"></td></tr>
  199.  
  200.  
  201.  
  202. <tr><td>Apellidos:</ttd><td><input type="text" name="apellidos"></td></tr>
  203.  
  204.  
  205.  
  206. <tr><td>Profesion:</td><td><input type="text" name="profesion"></td></tr>
  207.  
  208.  
  209.  
  210. <tr><td>Ciudad de Nacimiento</td><td><select name="ciudad" value="ciudad"size="1"maxlength="15">
  211.  
  212.    <center><option selected value="Barranquilla">Barranquilla</center><br>
  213.  
  214.    <center><option selected value="Bogota">Bogota</center><br>
  215.  
  216.    <center><option selected value="Cali">Cali</center><br>
  217.  
  218.   <center><option selected value="Cartagena">Cartagena</center><br>
  219.  
  220.   <center><option selected value="Neiva">Neiva</center><br>
  221.  
  222.    <center><option selected value="Popayan">Popayan</center>
  223.  
  224.   </select></td></tr>
  225.  
  226.  
  227.  
  228. <tr><td>Fecha Nacimiento:</td><td><input type="text" name="fechanaci"></td></tr>
  229.  
  230.  
  231.  
  232. <tr><td>Foto</td><td><input type="file" name="userfile"></td></tr>
  233.  
  234. </td></tr>
  235.  
  236. </table><br></br>
  237.  
  238. <center><input type="submit" value="ENVIAR"></center>
  239.  
  240.  </td></tr>
  241.  
  242. </table>
  243.  
  244. </table>
  245.  
  246. </table>
  247.  
  248. </td></tr>
  249.  
  250. </table>
  251.  
  252. <table border="0" width="100%" heigth="10%" align="center" bgcolor="#ffffff">
  253.  
  254. <tr>
  255.  
  256.  <td align="center">
  257.  
  258.   <a href="http://"><center><img border="0" src="cosas/cc.gif" width="150" height="30"><br>Acerca de Nosotros</a> |
  259.  
  260.   <a href="http://">Contactanos</a> |
  261.  
  262.   <a href="http://">Mapa del Sitio</a></center><br>
  263.  
  264.   <p>&copy 2002 Marca Registrada<br>
  265.  
  266.    <a href="http://www.nacionalderesistencias.com"><H4>http://www.nacionalderesistencias.com</H4></a>
  267.  
  268.  </td>
  269.  
  270. </tr>
  271.  
  272. </table>
  273.  
  274. </body>
  275.  
  276. </html>
  277.  

Ahora recien podremos leer tu codigo.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines