简体   繁体   中英

Recordset Query using $_GET variables

I have created a user search form and a results page for querying a database. The query works perfect if the user enters in search criteria perfectly (passing variables using PHP). My question is: How can I make the SQL code query based on user input if it is not exactly what is in the database? I tried using the LIKE function with bookName but it does not work. Any help would be appreciative.

SELECT *
FROM book
WHERE authFName = colname OR authLName = varauthLName OR ISBN = varISBN OR bookName LIKE
varbookName OR Class_classNbr = varclassNumber
ORDER BY authLName ASC

Try using '%' with the "Like" command. It works like a wildcard.

As :

LIKE '%varbookName%'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM