I have a form with dropdownlist containing fieldnames like firstname, lastname
I have a textbox to type the keyword.
According to the fieldname selected in dropdown and the keyword typed in textbox , I have to filter the user details.
I have written a stored procedure with prepared statement. But its not working.
create procedure prcUsers
declare f,v varchar(30);
set @q= concat('select * from tbmstuser where ',f,'=? like',v,'=?%');
prepare stmt from @q;
execute stmt using @fname, @val;
deallocate prepare stmt;
calling the procedure gives me the following error
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 0.000 sec
Have to call like this