DiscoTrio Posted December 5, 2009 Share Posted December 5, 2009 I need to make a preview of items in a table so that I have a row called 'title' a row call 'content' limited to 100 characters and only show 3. Here is what I have: sql_query("SELECT LEFT (content, 100) FROM snews WHERE id = 1 LIMIT 0, 3"); My problem is (as you can see) I am only selecting 'content' I just want to select the whole table(or 3 field, whatever is easier). Link to comment https://forums.phpfreaks.com/topic/184101-how-can-i-select-multiple-mysql-colombs-with-left-command/ Share on other sites More sharing options...
kickstart Posted December 5, 2009 Share Posted December 5, 2009 Hi Just specify the column name(s) sql_query("SELECT title, LEFT (content, 100) FROM snews WHERE id = 1 LIMIT 0, 3"); You can use a * instead of specifying the column names but this isn't really recommended for maintenance reasons. All the best Keith Link to comment https://forums.phpfreaks.com/topic/184101-how-can-i-select-multiple-mysql-colombs-with-left-command/#findComment-971976 Share on other sites More sharing options...
fenway Posted December 5, 2009 Share Posted December 5, 2009 So? Use * or specify the fields you want... what doesn't work? Link to comment https://forums.phpfreaks.com/topic/184101-how-can-i-select-multiple-mysql-colombs-with-left-command/#findComment-971978 Share on other sites More sharing options...
DiscoTrio Posted December 5, 2009 Author Share Posted December 5, 2009 Easier then I thought.... thanx. Link to comment https://forums.phpfreaks.com/topic/184101-how-can-i-select-multiple-mysql-colombs-with-left-command/#findComment-971979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.