aphostrofe - mysql_real_escape_string

Hi,
I have a form with a varchar field.
in this filed I have to insert a name like MICHAEL’S, but the application return this error :

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 ‘S CAR’) OR (cli_cognome = ‘EUROPE MICHAEL’S CAR’ AND CLI_ID < 96))’ at line 1
SELECT COUNT(*) FROM tb_ana_clienti WHERE ((cli_cognome < ‘EUROPE MICHAEL’S CAR’) OR (cli_cognome = ‘EUROPE MICHAEL’S CAR’ AND CLI_ID < 96))

how can I resolve the error ? How can I use mysql_real_escape_string or similar function ?

thank’s
massimo

Re: aphostrofe - mysql_real_escape_string

where is this code? Its generate by ScriptCase or is a lookup or event…?

Re: aphostrofe - mysql_real_escape_string

hi,
in this form there aren’t eevent…
this is the debug message with the error

Transactions not supported in ‘mysql’ driver. Use ‘mysqlt’ or ‘mysqli’ driver
(mysql): INSERT INTO tb_ana_clienti (CLI_TPCLI_FK, CLI_COGNOME, CLI_NOME, CLI_TPSOC_FK, CLI_NASCITA_DATA, CLI_NASCITA_COM_FK, CLI_NASCITA_COMUNE_ESTERO, CLI_NASCITA_PROV_FK, CLI_NASCITA_NAZ_FK, CLI_SESSO, CLI_CODICE_FISCALE, CLI_PARTITA_IVA, CLI_NAZIONALITA_NAZ_FK, CLI_RESIDENZA_COM_FK, CLI_RESIDENZA_PROV_FK, CLI_RESIDENZA_TOP_FK, CLI_RESIDENZA_INDIRIZZO, CLI_RESIDENZA_CIVICO, CLI_RESIDENZA_CAP, CLI_IDENTITA_TPDOC_FK, CLI_IDENTITA_NUMERO_DOC, CLI_IDENTITA_DATA_RILASCIO_DOC, CLI_IDENTITA_AUT_FK, CLI_IDENTITA_DOC_COM_FK, CLI_IDENTITA_DOC_PROV_FK, CLI_FLAG_VALID, CLI_DATA_FLAG_VALID, CLI_ANAG_RIF_FK, CLI_FORMA_GIURIDICA, CLI_IDENTITA_DATA_SCAD_DOC, CLI_TITOLO, CLI_EXPORT_COD) VALUES (5, ‘MICHEAL’S’, ‘’, 15, null, 0, ‘’, ‘’, ‘’, ‘’, ‘’, ‘08747410010’, ‘’, 126, ‘AL’, 14, ‘DESTRO’, ‘12’, ‘12345’, 0, ‘’, null, 0, 0, ‘’, ‘1’, ‘2011-01-21 23:46:43’, 0, ‘A’, null, ‘DA’, ‘’)

(mysql): select last_insert_id()

(mysql): SELECT CLI_ID, CLI_TPCLI_FK, CLI_COGNOME, CLI_NOME, CLI_TPSOC_FK, CLI_NASCITA_DATA, CLI_NASCITA_COM_FK, CLI_NASCITA_COMUNE_ESTERO, CLI_NASCITA_PROV_FK, CLI_NASCITA_NAZ_FK, CLI_SESSO, CLI_CODICE_FISCALE, CLI_PARTITA_IVA, CLI_NAZIONALITA_NAZ_FK, CLI_RESIDENZA_COM_FK, CLI_RESIDENZA_PROV_FK, CLI_RESIDENZA_TOP_FK, CLI_RESIDENZA_INDIRIZZO, CLI_RESIDENZA_CIVICO, CLI_RESIDENZA_CAP, CLI_IDENTITA_TPDOC_FK, CLI_IDENTITA_NUMERO_DOC, CLI_IDENTITA_DATA_RILASCIO_DOC, CLI_IDENTITA_AUT_FK, CLI_IDENTITA_DOC_COM_FK, CLI_IDENTITA_DOC_PROV_FK, CLI_FLAG_VALID, CLI_DATA_FLAG_VALID, CLI_ANAG_RIF_FK, CLI_FORMA_GIURIDICA, CLI_IDENTITA_DATA_SCAD_DOC, CLI_TITOLO, CLI_EXPORT_COD from tb_ana_clienti WHERE (CLI_ID = 34) order by cli_cognome

(mysql): SELECT COUNT(*) FROM tb_ana_clienti

(mysql): SELECT COUNT(*) FROM tb_ana_clienti WHERE ((cli_cognome < ‘MICHEAL’S’) OR (cli_cognome = ‘MICHEAL’S’ AND CLI_ID < 34)) 1064: 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 ‘S’) OR (cli_cognome = ‘MICHEAL’S’ AND CLI_ID < 34))’ at line 1

 ADOConnection._Execute(SELECT COUNT(*) FROM tb_ana_clienti WHERE ((cli_cognome &lt; 'MICHEAL'S') OR (cli_cognome = 'MICHEAL'S' AND CLI_ID &lt; 34)), false) % line 1010, file: adodb.inc.php

ADOConnection.Execute(SELECT COUNT(*) FROM tb_ana_clienti WHERE ((cli_cognome < ‘MICHEAL’S’) OR (cli_cognome = ‘MICHEAL’S’ AND CLI_ID < 34))) % line 4187, file: form_tb_ana_clienti_apl.php
form_tb_ana_clienti_apl.controle_navegacao() % line 5233, file: form_tb_ana_clienti_apl.php
form_tb_ana_clienti_apl.nm_acessa_banco() % line 1156, file: form_tb_ana_clienti_apl.php
form_tb_ana_clienti_apl.controle() % line 1500, file: form_tb_ana_clienti.php

Re: aphostrofe - mysql_real_escape_string

cli_cognome is primary key?

once you have CLI_TPCLI_FK as a primary key you dont need in the where statement…