elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
28 Mayo 2012, 12:33  


Tema destacado: Entra al canal IRC oficial de #elhacker.net

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

Desconectado Desconectado

Mensajes: 20


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

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: 20


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

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
DonVidela


Desconectado Desconectado

Mensajes: 1.617



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

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

Código
 
<?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>
 

Ahora recien podremos leer tu codigo.
En línea

Aprendiendo: Java , C# , pl/sql, mysql , sql server, PHP , Access, JSF, Facelets, JSP, CakePHP, JQuery

http://pablovidela.wordpress.com
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines