Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1

    [MYSQL] errore per un accento

    Ciao a tutti!!!!

    Sto copiando dei dati da una tabella as400 a una tabella mysql.

    Nella tabella as400 ho un record come questo " Dalpra' Renato " e proprio in quel record mi viene l'errore sql.
    Questo:

    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 'RENATO ')' at line 1

    Come posso fare per ovviare tale problema?

    Grazie e ciao

  2. #2
    devi aggiungere i backslash Dalpra\' Renato
    Chiamatemi sven se volete non ho voglia di fare una nuova email per una nuova registrazione xD
    Mac Future User , Ventilatore for PC Cooler user , - dry is coming -

  3. #3
    classico problema dove prima o poi incappano tutti

    http://it.php.net/manual/it/function.addslashes.php

    ciao

  4. #4
    devi utilizzare il carattere di escape previsto per il tuo db. puo' essere \ oppure '.

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  5. #5
    Scusate l'gnoranza ma dove devo mettere tale funzione nel mio script?


    Codice PHP:


    $nome_driver_odbc 
    "***";
    $username "***";
    $password "***";

    $as odbc_connect($nome_driver_odbc$username$password);

    $as_query odbc_exec($as"select CONTCP, DSCOCP from CGPCO00F 
    WHERE ((CONTCP) Between '0601000000' And '0603009999')"
    );

    if (
    $as_query)
    {

        while(
    odbc_fetch_row($as_query))
        {
        
        
    $CONTCP odbc_result($as_query,"CONTCP");
        
    $DSCOCP odbc_result($as_query,"DSCOCP");

        
    $sql=" INSERT INTO clienti";
        
    $sql.=" VALUES ('',    '$CONTCP', '$DSCOCP')";
        
        
    mysql_query($sql) or die (mysql_error());

        }
        
    odbc_free_result($as_query);
        
    odbc_close($as);



  6. #6
    addslashes($sql)
    Chiamatemi sven se volete non ho voglia di fare una nuova email per una nuova registrazione xD
    Mac Future User , Ventilatore for PC Cooler user , - dry is coming -

  7. #7
    Codice PHP:
    $sql=" INSERT INTO clienti";
        
    $sql.=" VALUES ('',    '$CONTCP', '$DSCOCP')";

    addslashes($sql);


    mysql_query($sql) or die (mysql_error());

        }
        
    odbc_free_result($as_query);
        
    odbc_close($as);



  8. #8
    Non funziona massimo80

    io ho fatto così:

    Codice PHP:

    if ($as_query)
    {

        while(
    odbc_fetch_row($as_query))
        {
        
        
    $CONTCP odbc_result($as_query,"CONTCP");
        
    $DSCOCP odbc_result($as_query,"DSCOCP");
        
        
    $CONTCP1 addslashes($CONTCP);
        
    $DSCOCP1 addslashes($DSCOCP);

        
    $sql=" INSERT INTO clienti";
        
    $sql.=" VALUES ('',    '$CONTCP1', '$DSCOCP1')";
        
        
    mysql_query($sql) or die (mysql_error());

        }
        
    odbc_free_result($as_query);
        
    odbc_close($as);



  9. #9
    si effetivamente è corretto come l'hai messo tu, non avevo visto che sql era la stesura della query....svista.
    che errore ti da sempre lo stesso??

  10. #10
    ferma tutto c'è la query sbagliata.

    elenca i nomi dei campi nel db

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.