onedumbcoder Posted August 10, 2009 Share Posted August 10, 2009 Ok lets say I have a table named box, and the box table has the following fields: apple, orange, screw, nut, pen, shoe, lock. How do I capture those as an array? SOmething like this "SELECT tablearray = array(apple, orange, screw, nut, pen, shoe, lock) from box" Link to comment https://forums.phpfreaks.com/topic/169526-create-an-array-inside-a-select-query/ Share on other sites More sharing options...
BLaZuRE Posted August 10, 2009 Share Posted August 10, 2009 It returns an array by default ... just do SELECT * FROM table_name You'll have to loop though to return each one of the rows. Link to comment https://forums.phpfreaks.com/topic/169526-create-an-array-inside-a-select-query/#findComment-894546 Share on other sites More sharing options...
onedumbcoder Posted August 10, 2009 Author Share Posted August 10, 2009 I know that, I want one of the elements returned to be an array. Link to comment https://forums.phpfreaks.com/topic/169526-create-an-array-inside-a-select-query/#findComment-895085 Share on other sites More sharing options...
Bjom Posted August 10, 2009 Share Posted August 10, 2009 there is no array data type in sql. you get an array per row in php easily when using the standard querying methods (mysqli or mysql). Link to comment https://forums.phpfreaks.com/topic/169526-create-an-array-inside-a-select-query/#findComment-895093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.