erme Posted December 15, 2009 Share Posted December 15, 2009 Hi, Im trying to select more then one field in a table for a search function. select * from TABLENAME where FIELDNAME1 FIELDNAME2 '%".$_GET['content']."%' Link to comment https://forums.phpfreaks.com/topic/185236-selecting-multiple-fields-from-a-table/ Share on other sites More sharing options...
Lamez Posted December 15, 2009 Share Posted December 15, 2009 SELECT * FROM $table WHERE col = 'val' Link to comment https://forums.phpfreaks.com/topic/185236-selecting-multiple-fields-from-a-table/#findComment-977843 Share on other sites More sharing options...
erme Posted December 15, 2009 Author Share Posted December 15, 2009 SELECT * FROM $table WHERE col = 'val' So will this work? select * from TABLENAME where col = 'FIELDNAME1 FIELDNAME2' '%".$_GET['content']."%' Link to comment https://forums.phpfreaks.com/topic/185236-selecting-multiple-fields-from-a-table/#findComment-977844 Share on other sites More sharing options...
Lamez Posted December 15, 2009 Share Posted December 15, 2009 no you need a and clause. SELECT * FROM $table WHERE col = 'val' AND col2 = 'val2' I think that is right. Link to comment https://forums.phpfreaks.com/topic/185236-selecting-multiple-fields-from-a-table/#findComment-977851 Share on other sites More sharing options...
erme Posted December 15, 2009 Author Share Posted December 15, 2009 Got it to work thanks Link to comment https://forums.phpfreaks.com/topic/185236-selecting-multiple-fields-from-a-table/#findComment-977872 Share on other sites More sharing options...
Lamez Posted December 15, 2009 Share Posted December 15, 2009 Hoped I helped. Mark as solved! Link to comment https://forums.phpfreaks.com/topic/185236-selecting-multiple-fields-from-a-table/#findComment-977875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.