Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Problemi con insert

Visualizzazione discussione

  1. #1

    Problemi con insert

    Qualcuno che mi sa dire perchè non mi fa questa insert?

    Codice PHP:

    if($_POST["status"] == "Chiusa")    
    {        
    $closed_date ", CURRENT_DATE()";    }
       
    else{ 
    $closed_date ", ''";}
    $sql "INSERT INTO t_staff_notes                     
                 (id_staff, note, status, date, last_date, closed_date)                     
                 VALUES ('"
    .$_SESSION["id_username"]."',                    
                 '"
    .$_POST["note"]."',                    
                 '"
    .$_POST["status"]."',                     
                 CURRENT_DATE(),                    
                 CURRENT_DATE() "
    .$closed_date;

    //se c' è un errore    
    if(!mysql_query($sql))           
    {                       
            
    //Stampo messaggio avvisando dell' errore nella query       
           
    header("location: home_notes.php?sez=note_form&msgerror=2");            
    }    

    else    {        

                    
    //Stampo messaggio di buon fine      
                   
    header("location: home_notes.php?msginfo=1");
                 } 
    La query stampata a video con php:

    INSERT INTO t_staff_notes (id_staff, note, status, date, last_date, closed_date) VALUES ('77', 'valore', 'Chiusa', CURRENT_DATE(), CURRENT_DATE() , CURRENT_DATE()

    Mi da queta notice:

    Notice: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7 in C:\Program Files\xampp\htdocs\bs_site\home\staff\notes\insert _or_update.php on line 108


    ​Grazie
    Ultima modifica di camionistaxcaso; 10-11-2014 a 00:33

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.