search

Home  >  Q&A  >  body text

Does anyone know how to modify the results of fuzzy query?

Since this is my first time learning PHP, my level is still very poor. If you can get some advice from an expert, I would be very grateful!

The problem is like this. Our group is planning to build a book website. The front end can enter the book name for fuzzy search. The query code is like this. Query the title field from the books table. For example, I entered the field harry

$q1="SELECT * FROM books WHERE title like '%".$_POST['title']."%'";

1.JPG

After query Return all the results whose book titles contain harry. The code is as follows

4.JPG

The page returned by the query is as follows

2.JPG

I added a "modify" button after the query results. I want to jump to another page to modify the book information by clicking this button. The code executed after clicking the button is like this

9.JPG

But no matter which book I click on the modify button, the data of that book is not read after the page jumps

3.JPG

I want to ask Does anyone know where this went wrong?

If you do not use fuzzy query, for example, the code for searching books at the beginning is changed to this

$q1="SELECT * FROM books WHERE title ='".$title."'";

Enter the book title 1984

6.JPG

The query result is accurate

7.JPG

The page that jumps after clicking the modification also reads data

8.JPG

I am very confused as to why this happens

RainbowRainbow1668 days ago1173

reply all(0)I'll reply

No reply
  • Cancelreply