August 2nd, 2003, 06:35 AM
Join Date: Jul 2003
Time spent in forums: < 1 sec
Reputation Power: 0
mysql and characters
I'm writing program in C which writes _FILENAME_ to mysql database.
so I got variable (char) 'filename':
sprintf (&query, "INSERT INTO db (file) VALUES ('%s')", filename);
Then mysql is executing this query, it returns syntax error, becouse query have " ' " character.
OR in mysql it appears as:
Mysql ', \ symbols reads as control characters, so I need replace them to \' and \\ ?
* Does anyone have fast plain C function to replace these symbols ?
* Can I solve this problem by changing mysql query?
I am using gcc on linux.