Ciao, ho un problema dopo un update, in pratica se nel campo metto delle virgolette quando rivisualizzo il record mi crea dei problemi nella visualizzazione!
E' normale che faccia cosi' o e' un problema mio?
Ciao, ho un problema dopo un update, in pratica se nel campo metto delle virgolette quando rivisualizzo il record mi crea dei problemi nella visualizzazione!
E' normale che faccia cosi' o e' un problema mio?
inserisci i dati usando mysql_real_eascape_string() e stripslashes per leggere quando lo estrai.
Le virgolette sono usate anche come caratteri di controllo e quindi vanno precedute da un carattere di escape al momento dell'inserimento, carattere che andra' poi tolto per avere una corretta lettura della stringa inserita.
Il silenzio è spesso la cosa migliore. Pensa ... è gratis.
Non so come ottenere la situazione per la tua risposta:
inserisci i dati usando mysql_real_eascape_string() e stripslashes
Io uso zendcore come webserver e scrivo i dati sul db2 di un as400.
La stringa di aggiornamento e' questa:
$sql = "
update ACSSI_DAT.SRVRQ00F
set
SRVPMO = '$customerSRVPMO',
SRVVRM = '$customerSRVVRM',
SRVBLD = '$customerSRVBLD',
SRVREL = '$customerSRVREL',
SRVASP = '$customerSRVASP',
SRVDAT = '$customerSRVDAT',
SRVORA = '$customerSRVORA',
SRVPER = '$customerSRVPER',
SRVMOT = '$customerSRVMOT',
SRVCAS = '$customerSRVCAS',
SRVDUR = '$customerSRVDUR',
SRVWEK = '$customerSRVWEK',
SRVUSR = '$customerSRVUSR',
SRVVIS = '$customerSRVVIS',
SRVPRR = '$customerSRVPRR',
SRVVRR = '$customerSRVVRR',
SRVPCH = '$customerSRVPCH',
SRVVAS = '$customerSRVVAS',
SRVSOL = '$customerSRVSOL'
where SRVCLI = '$customerSRVCLI'
and SRVNUM = '$customerSRVNUM'
";
E' possibile fare come mi hai detto te in questo scenario?
Se si come posso fare?
Grazie
in mancanze di specifiche informazioni il database di 'default' su questo forum e' mysql. La mia risposta si riferiva a questo db.
Prova a stampare la query e identifica quale stringa ti da problemi.
ovviamente non potrai usare le funzioni php dedicate a mysql.
Il silenzio è spesso la cosa migliore. Pensa ... è gratis.
Allora l'errore che esce nell'update e' questo:
There was a problem updating the user into the database.
Echo of dynamically-built sql:
update ACSSI_DAT.SRVRQ00F set SRVPMO = 'OMS400 ', SRVVRM = '8.2', SRVBLD = '111', SRVREL = '02', SRVASP = '03', SRVDAT = '2007-12-31', SRVORA = '11.11.11', SRVPER = 'Deborah La Monica ', SRVMOT = 's20 " ', SRVCAS = 'N', SRVDUR = '1', SRVWEK = '2', SRVUSR = 'GUARN ', SRVVIS = 'CODVIS ', SRVPRR = 'VSEE ', SRVVRR = '1.2', SRVPCH = 'PATCH', SRVVAS = 'ASPPP', SRVSOL = 'don' t ' where SRVCLI = 'UNIFID' and SRVNUM = '1255'
Il problema sta' nel campo SRVMOT = s20 "
perche' ho messo l'apice.
Ora se eseguo la stessa update nel as400 non da errori, li darebbe se al posto del apice avessi messo la singola apice '.
Per il resto non so che informazioni ti servono sul db2 dell'as400.
Ciao, grazie
Prova a fare in tal modo:
$customerSRVPMO = stripslashes($customerSRVPMO);
$customerSRVVRM = stripslashes($customerSRVVRM);
.......
per tutte le variabili che usi nella stringa $sql.
Poi, fai:
$sql = "
update ACSSI_DAT.SRVRQ00F
set
(SRVPMO = \"$customerSRVPMO\",
SRVVRM = \"$customerSRVVRM\",
..........)
where SRVCLI = \"$customerSRVCLI\"
and SRVNUM = \"$customerSRVNUM\"
";
Speriamo.....
prima di tutto bisogna conoscere qual'e' il carattere di escape usato da db2, poi vedo un possibile errore anche qui:Originariamente inviato da guarnieri
Allora l'errore che esce nell'update e' questo:
There was a problem updating the user into the database.
Echo of dynamically-built sql:
update ACSSI_DAT.SRVRQ00F set SRVPMO = 'OMS400 ', SRVVRM = '8.2', SRVBLD = '111', SRVREL = '02', SRVASP = '03', SRVDAT = '2007-12-31', SRVORA = '11.11.11', SRVPER = 'Deborah La Monica ', SRVMOT = 's20 " ', SRVCAS = 'N', SRVDUR = '1', SRVWEK = '2', SRVUSR = 'GUARN ', SRVVIS = 'CODVIS ', SRVPRR = 'VSEE ', SRVVRR = '1.2', SRVPCH = 'PATCH', SRVVAS = 'ASPPP', SRVSOL = 'don' t ' where SRVCLI = 'UNIFID' and SRVNUM = '1255'
Il problema sta' nel campo SRVMOT = s20 "
perche' ho messo l'apice.
Ora se eseguo la stessa update nel as400 non da errori, li darebbe se al posto del apice avessi messo la singola apice '.
Per il resto non so che informazioni ti servono sul db2 dell'as400.
Ciao, grazie
SRVSOL = 'don' t '
![]()
Il silenzio è spesso la cosa migliore. Pensa ... è gratis.
Grazie a tutti e due, ma con $customerSRVPMO = stripslashes($customerSRVPMO);
non funziona, mentre non ho idea di quale e' il carattere di escape usato da db2 e non so come scoprirlo.
Comunque grazie, ciao