Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. errore di sintassi

errore di sintassi

Pianificato Fissato Bloccato Spostato Coding
3 Post 2 Autori 460 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • M
    M
    maubox8
    scritto su ultima modifica di
    User Attivo 0
    #1
    errore di sintassi

    raga qualcuno puo' aiutarmi? ci sto diventando scemo, ho aggiunto solo qualcosa e mi da
    Errore di sintassi nella query SQL vicino a 'add ,liv ,data_ass ,cod_qual ,altri_dati_dip1 ,altri_dati_dip2 ,altr' linea 1.

    Nella query ho messo $anag = mysql_query($q) or die (mysql_error());
    ma che vuol dire linea 1. Non riesco a trovare l'errore... eppure ho solo aggiunto dei campi....

    eppure andava prima....

    questa era la vecchia query:

    $q  = "insert into anag_dip (";
    $q .= "    id_utente";
    $q .= "   ,id_azienda";
    $q .= "   ,cognome";
    $q .= "   ,nome";
    $q .= "   ,data_nascita";
    $q .= "   ,citta_nascita";
    $q .= "   ,codice_fiscale";
    $q .= "   ,citta_residenza";
    $q .= "   ,indirizzo";
    $q .= "   ,cap";
    $q .= "   ,non_so";
    $q .= "   ,non_so2";
    $q .= "   ,non_so3";
    
    $q .= "   ,altri_dati_dip1";
    $q .= "   ,altri_dati_dip2";
    $q .= "   ,altri_dati_dip3";
    $q .= "   ,altri_dati_dip4";
    $q .= "   ,altri_dati_dip5";
    $q .= "   ,altri_dati_dip6";
    $q .= "   ,altri_dati_dip7";
    $q .= "   ,altri_dati_dip8";
    $q .= "   ,altri_dati_dip9";
    $q .= "   ,altri_dati_dip10";
    $q .= "   ,altri_dati_dip11";
    $q .= "   ,altri_dati_dip12";
    $q .= "   ,altri_dati_dip13";
    
    $q .= " ) values (";
    $q .= "    (SELECT user_id FROM tbl_users WHERE user_name = '" . $_SESSION['logged'][0] . "')";
    $q .= "   ,'" . $_POST['dittas'] . "'";
    $q .= "   ,'" . addslashes(trim($_POST['cognome'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['nome'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['data_nascita'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['citta_nascita'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['codice_fiscale'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['citta_residenza'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['indirizzo'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['cap'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['non_so'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['non_so2'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['non_so3'])) . "'";
    
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip1'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip2'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip3'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip4'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip5'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip6'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip7'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip8'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip9'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip10'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip11'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip12'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip13'])) . "'";
    
    $q .= " )";
    
    $anag = mysql_query($q);
    

    questa è la nuova:

    $q  = "insert into anag_dip (";
    $q .= "    id_utente";
    $q .= "   ,id_azienda";
    $q .= "   ,cognome";
    $q .= "   ,nome";
    $q .= "   ,data_nascita";
    $q .= "   ,citta_nascita";
    $q .= "   ,codice_fiscale";
    $q .= "   ,citta_residenza";
    $q .= "   ,indirizzo";
    $q .= "   ,cap";
    
    $q .= "   ,stato_civile";//nuovo campo
    $q .= "   ,stato_dip";//nuovo campo
    $q .= "   ,qualifica";//nuovo campo
    $q .= "   ,tratt_irpef";//nuovo campo
    $q .= "   ,part_full";//nuovo campo
    $q .= "   ,t_det_i";//nuovo campo
    $q .= "   ,pos_inps";//nuovo campo
    $q .= "   ,matr";//nuovo campo
    $q .= "   ,add";//nuovo campo
    $q .= "   ,liv";//nuovo campo
    $q .= "   ,data_ass";//nuovo campo
    $q .= "   ,cod_qual";//nuovo campo
    
    $q .= "   ,altri_dati_dip1";
    $q .= "   ,altri_dati_dip2";
    $q .= "   ,altri_dati_dip3";
    $q .= "   ,altri_dati_dip4";
    $q .= "   ,altri_dati_dip5";
    $q .= "   ,altri_dati_dip6";
    $q .= "   ,altri_dati_dip7";
    $q .= "   ,altri_dati_dip8";
    $q .= "   ,altri_dati_dip9";
    $q .= "   ,altri_dati_dip10";
    $q .= "   ,altri_dati_dip11";
    $q .= "   ,altri_dati_dip12";
    $q .= "   ,altri_dati_dip13";
    
    $q .= " ) values (";
    $q .= "    (SELECT user_id FROM tbl_users WHERE user_name = '" . $_SESSION['logged'][0] . "')";
    $q .= "   ,'" . $_POST['dittas'] . "'";
    $q .= "   ,'" . addslashes(trim($_POST['cognome'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['nome'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['data_nascita'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['citta_nascita'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['codice_fiscale'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['citta_residenza'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['indirizzo'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['cap'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['stato_civile'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['stato_dip'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['qualifica'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['tratt_irpef'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['part_full'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['t_det_i'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['pos_inps'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['matr'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['add'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['liv'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['data_ass'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['cod_qual'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip1'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip2'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip3'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip4'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip5'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip6'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip7'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip8'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip9'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip10'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip11'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip12'])) . "'";
    $q .= "   ,'" . addslashes(trim($_POST['altri_dati_dip13'])) . "'";
    
    $q .= " )";
    
    $anag = mysql_query($q) or die (mysql_error());
    

    eppure nel database i campi sono tutti inseriti

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • T
      T
      thedarkita
      ModSenior
      scritto su ultima modifica di
      Super User 70
      #2

      Stai mischiando insert e select O.o
      ti consiglio di rivedere il funzionamento di entrambi...

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0
      • M
        M
        maubox8
        scritto su ultima modifica di
        User Attivo 0
        #3

        Thedarkita

        Stai mischiando insert e select O.o
        ti consiglio di rivedere il funzionamento di entrambi...

        Grazie, il problema era nel nome della variabile che avevo stabilito: "add".
        Andava messo tra apici altrimenti faceva casino con mysql...
        Ho cambiato nome, ora va...anche se devo capire bene il problema...
        Grazie comunque... Ciao

        1 Risposta Ultima Risposta
        Miglior risposta 0
        0

        Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

        Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

        Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

        Registrati Accedi
        Rispondi
        • Risposta alla discussione
        Effettua l'accesso per rispondere
        • Da Vecchi a Nuovi
        • Da Nuovi a Vecchi
        • Più Voti


        • Accedi

        • Non hai un account? Registrati

        • Accedi o registrati per effettuare la ricerca.
        • Primo post
          Ultimo post
        Home Accedi Registrati
        Menu
        • CATEGORIES
        • La Community Connect.gt
        • Presentati alla Community
        • News Ufficiali da Connect.gt
        • Internet News
        • A Scuola Di
        • Digital Marketing
        • Intelligenza Artificiale
        • SEO & GEO
        • Web Marketing e Content
        • Google Analytics e Web Analytics
        • Google Ads & Advertising
        • YouTube
        • TikTok, Instagram e altri Social
        • Google Adsense, Affiliazioni e Guadagno
        • E-Commerce
        • Coding e Sistemistica
        • Help Center: consigli per il tuo progetto
        • Hosting e Cloud
        • Coding
        • CMS & Piattaforme Self-Hosted
        • Annunci e Collaborazioni
        • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
        • Collaborazioni WEB e Lavoro: offro e cerco
        • Impresa, Fisco e Leggi
        • Consulenza Legale e Professioni Web
        • Consulenza Fiscale, Imprese, Startup e P.Iva
        • Gli Off Topic
        • PC, Smartphone e altri Hardware
        • Tutti i Software
        • GT Fetish Cafè
        • Discussioni
        • Non letti 0
        • Recenti
        • Hashtag
        • Popolare
        • Utenti
        • Privacy
        • Termini e condizioni
        • © 2026 Search On Media Group S.r.l.