Foros del Web » Programando para Internet » PHP »

Conexión de mi proyecto con mysql no se

Estas en el tema de Conexión de mi proyecto con mysql no se en el foro de PHP en Foros del Web. Hola amigos como están necesito su ayuda e creado un index.html donde esta una lista de nombres y al lado un combox para marcar asistencia ...
  #1 (permalink)  
Antiguo 10/06/2012, 01:34
Avatar de freddy31DA  
Fecha de Ingreso: junio-2012
Mensajes: 84
Antigüedad: 14 años, 4 meses
Puntos: 2
Información Conexión de mi proyecto con mysql no se

Hola amigos como están necesito su ayuda e creado un index.html donde esta una lista de nombres y al lado un combox para marcar asistencia .
Si asistio le podre: A
Si falto F : imagen :

Codigo :
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<
title>Untitled Document</title>
<
style type="text/css">
.
sss {
    
font-weight: bold;
    
color: #FC3;
}
.
sss #form1 table tr td table tr td {
    
color: #000;
}
body {
    
background-color: #666;
}
</
style>
</
head>

<
body class="sss">
<
p>Registro de Asistencia de mi Escuela ;</p>
<
form id="form1" name="form1" method="post" action="procesar.php">
  <
table width="379" border="1">
    <
tr>
      <
td width="317"><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td>VALDERRAMA VALLEJO, BEVERLY</td>
        </
tr>
      </
table></td>
      <
td width="46"><select name="adr1">
      <
option value="A">A</option ><option value="F">F</option></select></td>

    </
tr>
    <
tr>
      <
td><table width="307" cellpadding="0" cellspacing="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>VALDEZ CAMPOS, ELIZABETH DINA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr2">
      <
option value="A">A</option> <option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>VALDEZ SERVAN, LUIS FERNANDO</td>
        </
tr>
      </
table></td>
      <
td><select name="adr3">
      <
option value="A">A</option> <option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td>VALDIVIESO CALLE, MARILYN</td>
        </
tr>
      </
table></td>
      <
td><select name="adr4">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>VALENCIA CORNEJO, PATRICIA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr5">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ZAVALETA DETQUIZN, JAVIER</td>
        </
tr>
      </
table></td>
      <
td><select name="adr6">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td>ALVARADO ACOSTA, ANALI ROXANA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr7">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ALVARADO FARRO, JOSELYN DIANA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr8">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ANAYA VSQUEZ , KATHERINE</td>
        </
tr>
      </
table></td>
      <
td><select name="adr9">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ARANA MENDOZA, SAIDA MELISA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr10">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ARISTA PADIA, ZULY KARIN</td>
        </
tr>
      </
table></td>
      <
td><select name="adr11">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ARRIOLA GIL, SERGIO</td>
        </
tr>
      </
table></td>
      <
td><select name="adr12">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ARROYO CARBAJAL, KEEN</td>
        </
tr>
      </
table></td>
      <
td><select name="adr13">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>ATENCIO PAZ, PAMELA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr14">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>GUZMN VENTURA, JHOSELIN JANET</td>
        </
tr>
      </
table></td>
      <
td><select name="adr15">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>HERNANDEZ MARTINEZ, MARIA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr16">
      <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>HERNNDEZ OCAMPO, KATHERINE</td>
        </
tr>
      </
table></td>
      <
td><select name="adr17">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>HIDROGO CERDAN, CARLOS D.</td>
        </
tr>
      </
table></td>
      <
td><select name="adr18">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td height="20"></td>
          <
td>HUAMN GONZALES, INDIRA</td>
        </
tr>
      </
table></td>
      <
td><select name="adr19">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table cellspacing="0" cellpadding="0">
        <
tr height="20">
          <
td>IPANAQUE GUZMN, ARACELY</td>
        </
tr>
      </
table></td>
      <
td><select name="adr20">
     <
option value="A">A</option><option value="F">F</option></select></td>
    </
tr>
    <
tr>
      <
td><table width="183" cellpadding="0" cellspacing="0">
        <
tr height="20">
          <
td width="272"><input type="submit" name="Enviar" id="Enviar" value="Enviar" /></td>
        </
tr>
      </
table></td>
      <
td>&nbsp;</td>
    </
tr>
  </
table>
</
form>
<
p>&nbsp;</p>
</
body>
</
html> 
SON 20 ALUMNOS BUENO AHORA YO NECESITO CREAR UN ARCHIVO LLAMDO procesar.php como lo indico en el action bueno amigos yo lo cree así :
Código PHP:
<?php

include("conexion.php");

    if(isset(
$_POST['adr1']) && !empty($_POST['adr1']) &&
    isset(
$_POST['adr2']) && !empty($_POST['adr2']) &&
    isset(
$_POST['adr3']) && !empty($_POST['adr3']) &&
    isset(
$_POST['adr4']) && !empty($_POST['adr4']) &&
    isset(
$_POST['adr5']) && !empty($_POST['adr5']) &&
    isset(
$_POST['adr6']) && !empty($_POST['adr6']) &&
    isset(
$_POST['adr7']) && !empty($_POST['adr7']) &&
    isset(
$_POST['adr8']) && !empty($_POST['adr8']) &&
    isset(
$_POST['adr9']) && !empty($_POST['adr9']) &&
    isset(
$_POST['adr10']) && !empty($_POST['adr10']) &&
    isset(
$_POST['adr11']) && !empty($_POST['adr11']) &&
    isset(
$_POST['adr12']) && !empty($_POST['adr12']) &&
    isset(
$_POST['adr13']) && !empty($_POST['adr13']) &&
    isset(
$_POST['adr14']) && !empty($_POST['adr14']) &&
    isset(
$_POST['adr15']) && !empty($_POST['adr15']) &&
    isset(
$_POST['adr16']) && !empty($_POST['adr16']) &&
    isset(
$_POST['adr17']) && !empty($_POST['adr17']) &&
    isset(
$_POST['adr18']) && !empty($_POST['adr18']) &&
    isset(
$_POST['adr19']) && !empty($_POST['adr19']) &&
    isset(
$_POST['adr20']) && !empty($_POST['adr20']))
    {
        
    
$conexion = mysql_connect($host,$user,$pw)or die("Problema al conectar el host");
    
mysql_select_db($bd,$conexion)or die("Problema al conectar la puta base de dat");
    
    
mysql_query("INSERT  INTO probando (Asistio,Falto)
    VALUES ('$_POST[adr1]','$_POST[adr2]','$_POST[adr3]','$_POST[adr4]','$_POST[adr5]','$_POST[adr6]','$_POST[adr7]','$_POST[adr8]','$_POST[adr9]','$_POST[adr10]','$_POST[adr11]','$_POST[adr12]','$_POST[adr13]','$_POST[adr14]','$_POST[adr15]','$_POST[adr16]','$_POST[adr17]','$_POST[adr18]','$_POST[adr19]','$_POST[adr20]')"
,$conexion);
    echo 
"datos insertador correctamente";
Pueden ver las variables en los select del index.html esta name="adr1" etc.. asta el 20 pues le e puesto así en mi archivo porcesar.php yy mi archivo de Conexion es :
__________________
Creo en Internet.
Amén.
  #2 (permalink)  
Antiguo 10/06/2012, 07:28
Avatar de gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 18 años, 10 meses
Puntos: 2658
Respuesta: Conexión de mi proyecto con mysql no se

Mira, tengo la impresión, por lo que llego a conocer de PHP, que tienes errores conceptuales de programación, por lo que yo te recomendaría que primero te dieses un paseo por el Foro de PHP para que le den una mirada a tu código.
Pide primero que te digan si vas bien allí, y luego aquí veremos el tema de la creación de una base de datos.

Digo esto, especialmente para no tener que borrarte el código directamente, ya que en el Foro de Base de Dtos no se tratan ni se deben postear códigos de programación de ningún lenguaje (Normas del Foro).

Paso tu post al Foro de PHP. Luego, y antes de seguir, trata de leer algo sobre SQL y la creación de base de datos, teniendo en cuenta (especialmente) que hacer programación con PHP no necesariamente tiene que ver con las BBDD, y ciertamente no tiene relación con SQL, que es otro tipo de lenguaje.
Te recomiendo esto, porque si no tienes ninguna experiencia en el tema, comenzar creando y diseñando una base sólo te meterá en complicaciones. El tema de BBDD no es un tema menor que pueda tratarse como simple "anexo"
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)

Última edición por gnzsoloyo; 10/06/2012 a las 08:06
  #3 (permalink)  
Antiguo 10/06/2012, 14:40
Avatar de freddy31DA  
Fecha de Ingreso: junio-2012
Mensajes: 84
Antigüedad: 14 años, 4 meses
Puntos: 2
Respuesta: Conexión de mi proyecto con mysql no se

Cita:
Iniciado por gnzsoloyo Ver Mensaje
Mira, tengo la impresión, por lo que llego a conocer de PHP, que tienes errores conceptuales de programación, por lo que yo te recomendaría que primero te dieses un paseo por el Foro de PHP para que le den una mirada a tu código.
Pide primero que te digan si vas bien allí, y luego aquí veremos el tema de la creación de una base de datos.

Digo esto, especialmente para no tener que borrarte el código directamente, ya que en el Foro de Base de Dtos no se tratan ni se deben postear códigos de programación de ningún lenguaje (Normas del Foro).

Paso tu post al Foro de PHP. Luego, y antes de seguir, trata de leer algo sobre SQL y la creación de base de datos, teniendo en cuenta (especialmente) que hacer programación con PHP no necesariamente tiene que ver con las BBDD, y ciertamente no tiene relación con SQL, que es otro tipo de lenguaje.
Te recomiendo esto, porque si no tienes ninguna experiencia en el tema, comenzar creando y diseñando una base sólo te meterá en complicaciones. El tema de BBDD no es un tema menor que pueda tratarse como simple "anexo"
ok gracias por responder hay vamos
__________________
Creo en Internet.
Amén.

Etiquetas: Ninguno
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 04:56.