insert no funciona
Publicado por wbeimar Rodriguez (9 intervenciones) el 29/01/2009 19:31:44
Tengo este codigo para hacer un Insert en una tabla MySQL
<?php
$Department = $_SESSION['Dept'];
$nombre_usuario = $_SESSION['usr_name'];
$user = $_SESSION['usr_session'];
mysql_select_db($db, $global_dbh) OR die ("No se puede conectar");
$sql="insert into cambiohorario (ID, Apellido, Nombre, NumeroCC, NumeroTel, eMail, NumeroCel, Departamento, Supervisor, Login, HorarioActual, Full, Part, FechaIniNvoHorario, NuevoHorario, ft, pt, Motivo) values (null, '$apellido', '$nombre', '$cc', '$tel', '$email', '$cel', '$dept', '$sup', '$user', '$horact', '$ft', '$pt', '$fechanew', '$hornue', '$newfulltime', '$newparttime', '$motivo')";
$result=mysql_query($sql,$global_dbh);
if (mysql_affected_rows() == 1) {
echo "<P><font size = 6 color="#ffffff"> $nombre_usuario your information has been recorded. </font></P>";
echo "<P><font size = 6 color="#ffffff"> Please select your next action. </font></P>";
} else {
error_log(mysql_error());
echo "<P><font size = 6 color="#ffffff"> $nombre_usuario Something went wrong with your update attempt.</font></P>";
echo "<P><font size = 6 color="#ffffff"> Please try again. </font></P>";
}
?>
las variables se capturan en un formulario en metodo post, he revisado el codigo hasta ell cansancio y no veo porque no funciona, agradezco la ayuda que me puedan brindar.
<?php
$Department = $_SESSION['Dept'];
$nombre_usuario = $_SESSION['usr_name'];
$user = $_SESSION['usr_session'];
mysql_select_db($db, $global_dbh) OR die ("No se puede conectar");
$sql="insert into cambiohorario (ID, Apellido, Nombre, NumeroCC, NumeroTel, eMail, NumeroCel, Departamento, Supervisor, Login, HorarioActual, Full, Part, FechaIniNvoHorario, NuevoHorario, ft, pt, Motivo) values (null, '$apellido', '$nombre', '$cc', '$tel', '$email', '$cel', '$dept', '$sup', '$user', '$horact', '$ft', '$pt', '$fechanew', '$hornue', '$newfulltime', '$newparttime', '$motivo')";
$result=mysql_query($sql,$global_dbh);
if (mysql_affected_rows() == 1) {
echo "<P><font size = 6 color="#ffffff"> $nombre_usuario your information has been recorded. </font></P>";
echo "<P><font size = 6 color="#ffffff"> Please select your next action. </font></P>";
} else {
error_log(mysql_error());
echo "<P><font size = 6 color="#ffffff"> $nombre_usuario Something went wrong with your update attempt.</font></P>";
echo "<P><font size = 6 color="#ffffff"> Please try again. </font></P>";
}
?>
las variables se capturan en un formulario en metodo post, he revisado el codigo hasta ell cansancio y no veo porque no funciona, agradezco la ayuda que me puedan brindar.
Valora esta pregunta


0