php mysql search for text

46
February 22, 2021, at 08:20 AM

I am writing a blog, and i have to post things in series, and i need to link them together. I want to input the next post id to the previous post. The challenge now being, is there a way to search using the mysql like expression to check for something like this: i have a title Mindset 2, which come from mindset 1, is there a way to search and get mindset 1 from the database, mindset 2? $sql = 'SELECT * FROM post WHERE title LIKE "mindset 2"';

Because i think the 1 and 2 will be a distraction to the search. Thanks

Answer 1

% - The percent sign represents zero, one, or multiple characters

try this one:

'SELECT * FROM post WHERE title LIKE "%mindset 2%"'

https://www.w3schools.com/sql/sql_like.asp

but anyway, I think it's better instead of fetching just a single post, you fetch the id and title of the previous and the next post, so you can put a link to them.

READ ALSO
Fixing Unbound local error: local variable reference before assignment

Fixing Unbound local error: local variable reference before assignment

I am getting an error saying "UnboundLocalError: local variable 'result_numerator' referenced before assignment" and not sure whyAny kind of help will be appreciated

35
Finding Javafx node sizes

Finding Javafx node sizes

I read somewhere that thegetWidth() function only works when the node itself is properly initiated

32
NodeJs Telegram bot on VPS, need help switching to webhook

NodeJs Telegram bot on VPS, need help switching to webhook

please, help me understand how to switch my Telegram bot from polling to webhookI have a VPS server where my bot is deployed

27