Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Mysql how do I do this?

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

abcde

Established Member
Impact
16
I wanna be able to search both title and bookid from the database,


I know i can use this to search for title

SELECT bookid,title
FROM " . TABLE_PREFIX . "book
WHERE title LIKE '%$query%'
ORDER BY DESC
LIMIT 1

and use this to search for book

SELECT bookid,title
FROM " . TABLE_PREFIX . "book
WHERE bookid LIKE '%$query%'
ORDER BY DESC
LIMIT 1

But how do i combine them into just 1?

Thanks
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Join the conditions with an OR in your WHERE clause (assuming you want either condition).

WHERE title LIKE '%$query%' OR bookid LIKE '%$query%'

Sounds like you're very new to this - the MySQL reference manual is your friend!
 
1
•••
Thanks. Yes I'm very new to php and database
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back