Foros del Web » Programando para Internet » PHP »

ayuda

Estas en el tema de ayuda en el foro de PHP en Foros del Web. hola tengo un problema para crear una aplicacion que almacene los datos de los trabajadores de una empresa , la finalidad de esto es que ...
  #1 (permalink)  
Antiguo 29/07/2008, 17:11
 
Fecha de Ingreso: julio-2008
Mensajes: 16
Antigüedad: 15 años, 9 meses
Puntos: 0
ayuda

hola tengo un problema para crear una aplicacion que almacene los datos de los trabajadores de una empresa , la finalidad de esto es que los trabajadores puedan acceder al sistema con su nick y password lo cual cuando entre el trabajador guardara la fecha y hora de entrada y salida del sistema .

bueno empece creando una base de datos en mysql llamada trabajador y una tabla llamada tb_trabajador en la cual se encuentra
el id autoincrement primary key , el nick , el password, el nombre , paterno , el materno , el area y el horario ..........

luego cree lo siguiente :

ingresardatos.php :

<?php
@$cn=mysql_connect("localhost","root","admin");
if(!$cn){
echo 'CONEXCION FALLIDA';
}
mysql_select_db("trabajo");

$sql="SELECT * FROM tb_trabajador";
$rs=mysql_query($sql);
?>
<html>
<strong><center><fieldset style="width:500px;height:450px;padding:4;font-family:Arial;font-size:14px">
<form method="POST" action="maestrdatos.php">
<center><h2>Ingreso de Datos</h2></center>
<br>
NICK USUARIO:<br><input type="text" name="TxtNick" size="30"><br>
CONTRASEÑA :<br><input type="password" name="TxtContraseña" size="30"><br>
NOMBRES:<br><input type="text" name="TxtNombres" size="30"><br>
APELLIDO PATERNO:<br><input type="text" name="TxtApePat" size="30"><br>
APELLIDO MATERNO:<br><input type="text" name="TxtApeMat" size="30"><br>
AREA :<br><input type="text" name="TxtArea" size="30"><br>
<p>
HORARIO :
<select name="TxtHorario">
<option>M</option>
<option>T</option>
<option>N</option>
</select>
</p>
<br/>
<a href="agregar.php">Agregar</a><br/>
<a href="eliminar.php">Eliminar</a><br/>
<a href="modificar.html">Modificar</a><br/>
</form>
<br>
</fieldset> </center> </strong>
<html>

maestrodatos.php :

<?php
//print_r($_POST);
mysql_connect('localhost','root','admin');
mysql_select_db('trabajo');


$nick=$_POST['txtNick'];
$nombres=$_POST['txtNombres'];
$apepat=$_POST['txt"TxtApePat"'];
$apemat=$_POST['txt"TxtApeMat"'];
$area=$_POST['txt"TxtArea"'];
$horario=$_POST['txt"TxtHorario"'];
$sql="INSERT INTO tb_trabajador(nick, nombres, apellido paterno, apellido materno, area, horario) VALUES('$nick','$nombres','$paterno','$materno','$ area','$horario')";
if(mysql_query($sql)){
echo 'REGISTRO GUARDADO CORRECTAMENTE';
}else{
echo 'NO SE PUDO GUARDAR';
}


$sql="SELECT * FROM tb_trabajador";
$rs=mysql_query($sql);

?>

eliminar.php :

<html>
<head>
<title>Agregar Personas</title>
</head>
<body>
<form method="post" action="borrar.php">
ID:<input type="text" name="txtId" /><br/>
<input type="submit" name="btnEliminar" value="Eliminar" />
</form>
</body>
</html>
<?php
?>

agregar.php:

<?php
//print_r($_POST);
mysql_connect('localhost','root','admin');
mysql_select_db('trabajo');
$sql="select * from tb_trabajador where id=".$_POST['txtId']."";
$rs=mysql_query($sql);


?>
<html>
<head>
<title>MAESTRO DATOS</title>
</head>
<body>
<center>
<table border="4">
<thead>
<th>ID</th>
<th>NICK USUARIO</th>
<th>NOMBRES</th>
<th>APELLIDO PATERNO</th>
<th>APELLIDO MATERNO</th>
<th>AREA</th>
<th>HORARIO</th>
</thead>
</center>
<tbody>

<tr>
<td><?php echo $reg[0]; ?></td>
<td><?php echo $reg[1]; ?></td>
<td><?php echo $reg[2]; ?></td>
<td><?php echo $reg[3]; ?></td>
<td><?php echo $reg[4]; ?></td>
<td><?php echo $reg[5]; ?></td>
<td><?php echo $reg[6]; ?></td>
</tr>

</tbody><br/>
</table><br/><br/>
<center>
<a href="ingresodatos.php">INGRESA DATO</a><br/><br/>
<a href="eliminar.php">ELIMININA DATO</a><br/>
</center>
</body>
</html>

y modificar.html:

<html>
<head>
<title>Modificar Personas</title>
</head>
<body>
<form method="post" action="agregar.php">
ID:<input type="text" name="TxtId" /><br/>
<input type="submit" name="btnGuardar" value="Guardar" />
</form>
</body>
</html>

el problema esta en que cuando quiero ingresar un dato , no se guarda ! !

alguien me podria ayudar ????????

y esto es una pregunta :

* como puedo hacer para que una vez lista la aplicacion y creada otra llamada login para q el usuario entre al sistema , como puedo hacer para que aparescar su hora de entrada con fecha y la de salida , ademas que se almacene un archivo llamado registrodeingresos por ejemplo

GRACIAS !!
  #2 (permalink)  
Antiguo 29/07/2008, 17:35
Avatar de richard187  
Fecha de Ingreso: julio-2008
Mensajes: 14
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: ayuda

hola
creo que tu problema esta en ( maestrodatos.php ):

prueba reemplazandoel sigte codigo:

Código PHP:
<?php
//print_r($_POST);
mysql_connect('localhost','root','admin');
mysql_select_db('trabajo');

$nick=$_POST['txtNick'];
$nombres=$_POST['txtNombres'];
$apepat=$_POST['txt"TxtApePat"'];
$apemat=$_POST['txt"TxtApeMat"'];
$area=$_POST['txt"TxtArea"'];
$horario=$_POST['txt"TxtHorario"'];
$sql="INSERT INTO tb_trabajador(nick, nombres, apellido paterno, apellido materno, area, horario)";
$sql.="VALUES('$nick','$nombres','$paterno','$materno','$area','$horario')";
$rs mysql_query($sql) or die("Error al conectar base de datos! :".mysql_error);
if(
$rs){
echo 
'REGISTRO GUARDADO CORRECTAMENTE';
}else{
echo 
'NO SE PUDO GUARDAR';
}

$sql="SELECT * FROM tb_trabajador";
$rs=mysql_query($sql);
?>
pruebalo y cualquier problema avisas

con respecto a tus preguntas, estoy seguro que vi muchos post similares que te pueden servir y ayudar, buscalos y suerte.!!

Saludos
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 12:05.