| | |
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 browser bug captchaformproblem cart checkbox child class close codes createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming progressbar prototype redirect runtime safari scale scriptlets scroll search security shopping size software toggle unicode w3c web wysiwyg \n





