Log in

View Full Version : update file



pavmoxo
04-19-2006, 03:27 PM
In the next code there is an error in sql code, that I donīt understand:


if (is_uploaded_file($_FILES['file']['tmp_name'])) {
move_uploaded_file($_FILES['file']['tmp_name'], "imagens/cine/".$_FILES['file']['name']);
if (is_file("imagens/cine/".$_FILES['file']['name'])) {
$sql = "update cinema set titulo_mes = '".$_POST["titulo_mes"]."', dia_sem = '".$_POST["dia_sem"]."', dia_mes = '".$_POST["dia_mes"]."', foto = "'imagens/cine/'.$_FILES["file"]["name"]."', titulo_film = '".$_POST["titulo_film"]."', realizador = '".$_POST["realizador"]."', actores = '".$_POST["actores"]."', ano = '".$_POST["ano"]."', pais = '".$_POST["pais"]."', idade = '".$_POST["idade"]."', duracao = '".$_POST["duracao"]."', genero = '".$_POST["genero"]."', site = '".$_POST["site"]."', trailer = '".$_POST["trailer"]."', descricao = '".$_POST["descricao"]."' where film_ID = ".$_POST["film_ID"];
$query = query($sql) or die ("Query failed: " . mysql_error() . " Actual query: " . $sql);

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in c:\ftproot\www\cm-lousa.pt\2.0\admin\cinema.php on line 54


What can I do for resolve it??

djr33
04-20-2006, 05:24 AM
Which one is line 54? that's just 5 lines... can't figure out which, heh.

Basically, you probably need to escape a quote so it doesn't end the operation and give an error:

Ex:
$var = "I said "hello" to him"; <ERROR!
$var = "I said\"hello\" to him; <escaped quotes, no error.


Edit: hmm... no... I think that error is related to a number that it doesn't like... can't remember exactly why.

but... yeah, post which line it is.

Twey
04-20-2006, 08:50 AM
Here:
'imagens/cine/'".$_FILES["file"]["name"]."'