whiteboikyle Posted July 1, 2008 Share Posted July 1, 2008 Okay well i am going to do a function that looks in the database.. like so function function_userlevel($userlevel){ global $config; $result = $config->query("SELECT * FROM userlevel where userlevel = '$userlevel'"); } Now see how i did select * from userlevel.. Well the query will come up with with somewhere between 5-10 results.. so how do i do a return $results.. but i need all the results.. so when i use this function it will list all of them. Link to comment https://forums.phpfreaks.com/topic/112852-function-get-info-help/ Share on other sites More sharing options...
DarkWater Posted July 1, 2008 Share Posted July 1, 2008 return $results; Then handle it. And don't use global data. Ever. Thanks. Link to comment https://forums.phpfreaks.com/topic/112852-function-get-info-help/#findComment-579628 Share on other sites More sharing options...
papaface Posted July 1, 2008 Share Posted July 1, 2008 Maybe: function function_userlevel($userlevel){ global $config; return $result = $config->query("SELECT * FROM userlevel where userlevel = '$userlevel'"); } Then loop through the array. Link to comment https://forums.phpfreaks.com/topic/112852-function-get-info-help/#findComment-579630 Share on other sites More sharing options...
whiteboikyle Posted July 1, 2008 Author Share Posted July 1, 2008 Maybe: function function_userlevel($userlevel){ global $config; return $result = $config->query("SELECT * FROM userlevel where userlevel = '$userlevel'"); } Then loop through the array. how come dont user global? how else would i get data from my config file.. lol Link to comment https://forums.phpfreaks.com/topic/112852-function-get-info-help/#findComment-579648 Share on other sites More sharing options...
DarkWater Posted July 1, 2008 Share Posted July 1, 2008 Pass it through the function call. Link to comment https://forums.phpfreaks.com/topic/112852-function-get-info-help/#findComment-579651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.