jaymc Posted October 21, 2006 Share Posted October 21, 2006 Take a look at the below code[code]SELECT * FROM artists WHERE ID IN (1,4,7,21,51) LIMIT 0,5[/code]I'm sure you know what thats doing..Well, ive just spend an hour trying to get this working..[code]SELECT * FROM artists WHERE username IN (ste,jeff,peter) LIMIT 0,3[/code]I can only assume the IN() stuff works with numbers only?If not, what am i doin wrong, if so... how can I replicate the function but querying for usernames rather than ID'sThanks Link to comment https://forums.phpfreaks.com/topic/24679-how-to-test-for-strings-usng-an-in-clause/ Share on other sites More sharing options...
fenway Posted October 22, 2006 Share Posted October 22, 2006 You need to quote string literals. Link to comment https://forums.phpfreaks.com/topic/24679-how-to-test-for-strings-usng-an-in-clause/#findComment-112786 Share on other sites More sharing options...
jaymc Posted October 22, 2006 Author Share Posted October 22, 2006 Can you give me an example? Link to comment https://forums.phpfreaks.com/topic/24679-how-to-test-for-strings-usng-an-in-clause/#findComment-112840 Share on other sites More sharing options...
fenway Posted October 22, 2006 Share Posted October 22, 2006 [code]SELECT * FROM artists WHERE username IN ('ste','jeff','peter') LIMIT 0,3[/code] Link to comment https://forums.phpfreaks.com/topic/24679-how-to-test-for-strings-usng-an-in-clause/#findComment-112855 Share on other sites More sharing options...
jaymc Posted October 23, 2006 Author Share Posted October 23, 2006 Dam!! I didnt realise about the ' 'Thanks ! Link to comment https://forums.phpfreaks.com/topic/24679-how-to-test-for-strings-usng-an-in-clause/#findComment-113077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.