Hopes dashed by dynamic MySQL query not working

I am really struggling with a MySQL query problem.

It looks similar to a problem raised recently here and which was SOLVED, but the same solution doesn’t work for me…?! Could someone please tell me what I’m doing wrong?

When I use a fixed value my query works (see below).

SELECT * FROM dummyTable
WHERE name LIKE ‘%a%’
LIMIT 10;

But when the input parameter is dynamic it doesn’t work. I’ve tried replacing LIKE with =, the $1 variable option, also @name. I get no results every time.

I’m using an input form and submit button workflow to make the query. I thought there could be a mistake there but Bubble is not flagging any errors.

For what it’s worth my Bubble account has Read-Only access to the MySQL database (but that should be fine as i’m not writing data…?).

Anyway, I’m making my first web app and very close to finishing but this has put a spanner in the works to say the least…!

Hi,

I was facing the same problem, I did a workaround using the concat function from MySQL:

For your case that will be
SELECT * FROM dummyTable
WHERE name LIKE concat(’%’, ?, ‘%’)
LIMIT 10;

It worked for me !

The MySQL code above by Youying helps optimize my SQL query but the solution (which Youying provided in a direct message to me - thanks a lot!) turned out to be related to my input.

I had originally set up a workflow, which wasn’t necessary.

What was needed was: In Repeating Group > Data Source > dummyTable be sure that name = Input FormTest’s value

That worked.