| | |
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 ajaxexample ajaxjspservlets array automatically beta box browser captchaformproblem cart child class close codes column css date debugger decimal dependent design disablefirebug dom download editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index java javascript javascripthelp2020 jquery jsf jsp jump libcurl listbox maps masterpage math media menu microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player position post problem programming prototype redirect safari scale scriptlets scroll search security select software toggle unicode w3c web window windowofwords \n





