Results 1 to 3 of 3

Thread: update file

  1. #1
    Join Date
    Apr 2006
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool update file

    In the next code there is an error in sql code, that I donīt understand:

    PHP Code:
    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??

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Here:
    Code:
    'imagens/cine/'".$_FILES["file"]["name"]."'
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franįais | entiendo espaņol | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •