Foros del Web » Programando para Internet » PHP »

No se ejecuta sentencia de mysql

Estas en el tema de No se ejecuta sentencia de mysql en el foro de PHP en Foros del Web. Hola nuevamente con problemas, tengo este problema, quiero subir datos a una tabla mysql, mas especificamente el nombre de un archivo subido por un applet ...
  #1 (permalink)  
Antiguo 03/12/2009, 15:09
 
Fecha de Ingreso: junio-2009
Mensajes: 31
Antigüedad: 14 años, 10 meses
Puntos: 0
No se ejecuta sentencia de mysql

Hola nuevamente con problemas, tengo este problema, quiero subir datos a una tabla mysql, mas especificamente el nombre de un archivo subido por un applet java, todo funciona de maravillas, osea el archivo subido es guardado en la ruta de destino pero no puedo lograr que se ejecute la sentencia para subir el nombre del archivo, ejemplo, si lo ubico antes del primer if() funciona, pero no puedo subir nada porque aun no tengo el nombre y si lo hago dentro del if() o despues no funciona, aqui va el codigo resaltado el codigo que no funciona

$sqlm="UPDATE Album SET imagen='".$variable."' WHERE id='".$variable2."'";
$results = mysql_query($sqlm);


if ($_FILES['userfile']['tmp_name']<>""){

// Note, this MUST have the trailing slash.
$uploaddir = '../albunes/'.$user.'/';
// Whether or not to allow the upload of specific files
$allow_or_deny = true;
// If the above is true, then this states whether the array of files is a list of
// extensions to ALLOW, or DENY
$allow_or_deny_method = "deny"; // "allow" or "deny"
$file_extension_list = array("php","asp","pl");
// -----------------------------------------------------------------------------
if ($allow_or_deny){
if (($allow_or_deny_method == "allow" && !in_array(strtolower(array_pop(explode('.', $_FILES['userfile']['name']))), $file_extension_list))
|| ($allow_or_deny_method == "deny" && in_array(strtolower(array_pop(explode('.', $_FILES['userfile']['name']))), $file_extension_list))){
// Atempt to upload a file with a specific extension when NOT allowed.
// 403 error
header("HTTP/1.1 403 Forbidden");
echo "POSTLET REPLY\r\n";
echo "POSTLET:NO\r\n";
echo "POSTLET:FILE TYPE NOT ALLOWED\r\n";
echo "POSTLET:ABORT THIS\r\n"; // Postlet should NOT send this file again.
echo "END POSTLET REPLY\r\n";
exit;
}
}
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .$_FILES['userfile']['name']))
{

// All replies MUST start with "POSTLET REPLY", if they don't, then Postlet will
// not read the reply and will assume the file uploaded successfully.
echo "POSTLET REPLY\r\n";
// "YES" tells Postlet that this file was successfully uploaded.
echo "POSTLET:YES\r\n";
// End the Postlet reply
echo "END POSTLET REPLY\r\n";
exit;

}
else
{
// If the file can not be uploaded (most likely due to size), then output the
// correct error code
// If $_FILES is EMPTY, or $_FILES['userfile']['error']==1 then TOO LARGE
if (count($_FILES)==0 || $_FILES['userfile']['error']==1){
// All replies MUST start with "POSTLET REPLY", if they don't, then Postlet will
// not read the reply and will assume the file uploaded successfully.
header("HTTP/1.1 413 Request Entity Too Large");
echo "POSTLET REPLY\r\n";
echo "POSTLET:NO\r\n";
echo "POSTLET:TOO LARGE\r\n";
echo "POSTLET:ABORT THIS\r\n"; // Postlet should NOT send this file again.
echo "END POSTLET REPLY\r\n";
exit;
}
// Unable to write the file to the server ALL WILL FAIL
else if ($_FILES['userfile']['error']==6 || $_FILES['userfile']['error']==7){
// All replies MUST start with "POSTLET REPLY", if they don't, then Postlet will
// not read the reply and will assume the file uploaded successfully.
header("HTTP/1.1 500 Internal Server Error");
echo "POSTLET REPLY\r\n";
echo "POSTLET:NO\r\n";
echo "POSTLET:SERVER ERROR\r\n";
echo "POSTLET:ABORT ALL\r\n"; // Postlet should NOT send any more files
echo "END POSTLET REPLY\r\n";
exit;
}
// Unsure of the error here (leaves 2,3,4, which means try again)
else {
// All replies MUST start with "POSTLET REPLY", if they don't, then Postlet will
// not read the reply and will assume the file uploaded successfully.
header("HTTP/1.1 500 Internal Server Error");
echo "POSTLET REPLY\r\n";
echo "POSTLET:NO\r\n";
echo "POSTLET:UNKNOWN ERROR\r\n";
echo "POSTLET:RETRY\r\n";
print_r($_REQUEST); // Possible usefull for debugging
echo "END POSTLET REPLY\r\n";
exit;
}
}

}
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:42.