hi
i have below structure in my database table

id eve_id cat_id member add_date
1 Tel1 5 1,2,3,4,5 0000-00-00
2 Acc2 2 3 0000-00-00
3 For3 3 1 0000-00-00
4 Acc4 2 5 0000-00-00
5 Acc5 2 6 0000-00-00


now my query is as below

$memque="select * from tblevent where '5' in (member)";

but i am not getting result, i want id 1 and 4 in answer . please help me

thanks

$memque="select * from tblevent where member like '%5%' ";

OR

$filter="5";
$memque="select * from tblevent where member like '%{$filter}%' ";

SELECT * FROM tblevent WHERE MATCH (member) AGAINST('5');

Or use a join

$memque="select * from tblevent left join member on member.member_id=tbleevent.member where member.member_id=5)";

This is assuming your member number in tblevent is the member id in your member table.

Member Avatar for diafol
$memque="SELECT * FROM tblevent WHERE member = 5";

seems the obvious answer to me. I assume you're running the query and extracting the info thereafter with a 'while' loop?

ardave is correct, can't believe I missed the basic solution and went for more complicated :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.