t_machine Posted November 23, 2006 Share Posted November 23, 2006 Hi, I would appreciate if anyone could help with this.I am using the following array of columns in my database query. I am using the sprintf function.This is my array of columns$mytbls= array('id', 'user_id', 'groupid', 'expire');I would like to use only the groupid from that array in something like the following$sql = sprintf("SELECT %s FROM TABLE_NAME", implode(', ', $mytbls) );If I keep it as the above, it will select all my columns but I only need the "groupid".Thanks :) Link to comment https://forums.phpfreaks.com/topic/28250-how-to-implode-3rd-value-in-array/ Share on other sites More sharing options...
wildteen88 Posted November 23, 2006 Share Posted November 23, 2006 Don't implode the array. Just use $mytbls[2] instead. Link to comment https://forums.phpfreaks.com/topic/28250-how-to-implode-3rd-value-in-array/#findComment-129215 Share on other sites More sharing options...
t_machine Posted November 23, 2006 Author Share Posted November 23, 2006 Thank you very much :) It works great now. Link to comment https://forums.phpfreaks.com/topic/28250-how-to-implode-3rd-value-in-array/#findComment-129221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.