| | |
Single quotes problem
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I have a database of book titles where string values are stored. A php script reads the data and displays them. The problem is happening when a Book title contains the ' character - as apostrophy let's say. One example is the title "The Devil's Alternative".
So when I write
var Title = <?php echo($Title) ?>;
it's becoming
var Title = 'The Devil's Alternative' ;
and giving an error as the quotes do not match.
How do I avoid this problem ? Also how to avoid some other character combinations (for example // or /* -- javascript will turn them into comments and generate errors)
So when I write
var Title = <?php echo($Title) ?>;
it's becoming
var Title = 'The Devil's Alternative' ;
and giving an error as the quotes do not match.
How do I avoid this problem ? Also how to avoid some other character combinations (for example // or /* -- javascript will turn them into comments and generate errors)
![]() |
Similar Threads
- Connection string (VB.NET)
- Qeury problem(plz help) (PHP)
- SQL query problem with WHERE clause (ASP)
- Problem with Perl syntax highlighter (DaniWeb Community Feedback)
- Problem with win32pipe ... (Python)
- Need help with the syntax problem (PHP)
- Problem with input (ASP)
- String Problem (Visual Basic 4 / 5 / 6)
- Index with int8 does not work without single quotes !?!? (must read) (Database Design)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: problem adding values with dynamic values
- Next Thread: Firefox JS onclick concurrency problem?!?
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate array automatically beta box bug calendar captchaformproblem cart checkbox child class close codes column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox focus forms frameworks google gwt gxt html htmlform ie8 iframe images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp jump listbox masterpage math menu microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent pdf php player post problem progressbar prototype redirect regex runtime scale scroll search select shopping size sql text textarea toggle w3c web website window windowofwords windowsxp wysiwyg \n





