php - How to escape a SQL query with colon in Jquery mobile? -


I am making a mobile web and tried to send a query to my server database with the following code:

$ user = "root"; $ Pass = ""; $ Db = new PDO ('mysql: host = localhost; dbname = the_restaurant', $ user, $ pass); $ Db- & gt; Set Attribute (PDO :: ATTRRAMOD, PDO :: ERMMDMEXEPTN); $ Stmt = $ db- & gt; Query ('SELECT * table_availability where table_number =: table'); $ Statement- & gt; Execute (array (': table' = & gt; $ table_number)); // Set Fitch Mode $ stmt-> Settet Mode (PDO :: FTHASASOC); While ($ line = $ stmt-> Fatch ()) {resonant "& lt; tr class = \" clickable \ "data-url = \" {orders.php} \ "& gt; & lt; Td> & lt; p & gt; $ Line ['dish_name']. " "; Echo "& lt; td & gt; & lt; p & gt;" . $ Line ['quantity']. " "; Echo "& lt; td & gt; & lt; p & gt;" . $ Line ['price'] " "; Echo "& lt; td & gt; & lt; p & gt;" . $ Line ['EWT']. "& Lt; / p> & gt;"; }

This query can be executed but my background image has disappeared. I discovered it and there was a colon in the criminal statement. Can I get rid of this problem anyway? Or any alternatives? I need my background for my UI I have already tried with backslash, but still it is the same:

  $ stmt = $ db- & gt; Query ('select * table_upplicity where table_number = \\: table');  

Any ideas I'm using jQuery Mobile?

By seeing this, it does not appear that you should use the query for the parameters containing < / P>

  $ sth = $ dbh- & gt; Prepare ('selection name, color, calories from WHERE calorie & lt;? And color =?'); $ Sth- & gt; Execute (Array (150, 'red')); $ Red = $ sth- & gt; Fatch ALL ();  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -