php - Querying table with an ampersand in the name -



php - Querying table with an ampersand in the name -

i'm in process of cleaning mysql database , have create similar changes across multiple tables. such, gather list of tables

$query = " select table_name information_schema.columns table_schema = 'mydb' , column_name = 'activecolumn'";

then iterate through each making changes need. problem of these tables have ampersand in title. guess php and/or mysql has problem this, throws direction

/* $query = "select * cats&dogs"; */ have error in sql syntax; check manual corresponds mysql server version right syntax utilize near '&dogs' @ line 1

i've found ways prepare issue when need insert ampersand in db , when have 1 in clause(truthfully, isn't total solution it's best found). if come in exact query in mysql without using php works.

what causing issue?

backticks. select * `cats&dogs`.

reference: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

php mysql

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -