Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

return a whole array

Asked Modified Viewed 1,101 times
P
PeaceLaced
P
PHP-Fusion MAIN Support Team
PHP-Fusion USA NSS Admin
  • Member, joined since
  • Contributed 154 posts on the community forums.
  • Started 23 threads in the forums
  • Started this discussions
asked
Member

UPDATE: I figured it out. For anyone interested, the function is the actual array data. Placing the function into a variable does the trick. I was trying to do this inside the function and it was not working. Here is how it should be:

$data = new_data(); // here we call the function and place it in a variable
echo $data['some_field']; // here we display one field of the array



function new_data() {

    $result = dbquery(SELECT FROM WHERE ORDER BY);
    if (dbrows($results) {
        return dbarray($result);
    }



How do I get an array out of a function. I seem to be having difficulty.

I want to first call my function, and then use the resulting array like we do $userdata['whatever']

example:
// wrong --------------------------------------------------------------
new_data(); // here we call the function
echo $data['some_field']; // here we display one field of the array
// wrong --------------------------------------------------------------

// wrong --------------------------------------------------------------
function new_data() {

    $result = dbquery(SELECT FROM WHERE ORDER BY);
    if (dbrows($results) {
        return $data = dbarray($result);
    }
// wrong --------------------------------------------------------------
Edited by PeaceLaced on 09-03-2014 06:38,
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

P
P
PHP-Fusion MAIN Support Team
PHP-Fusion USA NSS Admin
  • Member, joined since
  • Contributed 154 posts on the community forums.
  • Started 23 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet