SELECT * FROM admin where company='test & test'
I am running this query but getting error due to &.while printing Its showing
SELECT * FROM admin where company='test ',not accepting & in sql query

Can we run using & in query
need suggestion.

Recommended Answers

All 4 Replies

I just tried a query in phpmyadmin with a '&' in the query and it accepted it just fine. I don't have any data with an & in the data so I didn't get any results but it did accept it.

I tried your both query. It works fine.

SELECT * FROM admin where company='test & test'
I am running this query but getting error due to &.while printing Its showing
SELECT * FROM admin where company='test ',not accepting & in sql query

Can we run using & in query
need suggestion.

I've had this issue before. It would work doing a simple SQL statement in phpMyAdmin for example but wouldn't work within my PHP script. Is this your problem as well?

I don't know the solution as I haven't encountered it again lately.

its not working with in PHP script.but working fine in my sql.
SELECT * FROM admin where company='test & test'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.