Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:15:46+00:00 2026-06-05T15:15:46+00:00

I have a quick question about something I imagine must be pretty easy –

  • 0

I have a quick question about something I imagine must be pretty easy – I’ve done a little research and found some links that seem promising, especially this, but it doesn’t work for me for some reason.

Anyway, I made a stored procedure in MySQL and tested it with MySQL Workbench, and it works – it just adds num1 and num2 and returns the result. Now I’m trying to get it to work in PHP, but the result, instead of being an integer, is an array of one stdClass Object which contains that integer. That makes sense from the point of view of procedures that return a lot of data, but I’m having some trouble getting down to just the integer.

I run this:

   CALL database.routine(2,7)

And I save the results into $var. When I run print_r($var), I get:

    Array
    (
    [0] => stdClass Object
    (
    [num1+num2] => 9
    )
    )

So, to get past the Array part, I specifically asked for the first element in it, by running print_r($var[0]), which gets me:

    stdClass Object
    (
    [num1+num2] => 9
    )

And now I need to go one level deeper…I tried what the page I linked to above said and attempted to get to $var[0]->[num1+num2], as the field appears to be named, but that doesn’t work. I’ve also tried a few combinations of single quotes and double quotes, but no luck. How do I get the number 9 out of this object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:15:48+00:00Added an answer on June 5, 2026 at 3:15 pm

    Try…

    $var[0]->{'num1+num2'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick question about include/requre_once . I have some code that is common to a
I have quick question about text parsing, for example: INPUT=a b c d e
I have a quick question about ARC in iOS. (Sorry I've asked so many
I have a quick question about encapsulating specific types with typedef . Say I
I have a quick question about the dealloc() and viewDidUnload() methods. I notice a
I have a quick question about the accelerometer in Android devices. Is it always
I have a quick question about the layout of the page on a custom
I have a quick question about altering the build path as the code is
I just have a quick question about how to get the length of a
I have a quick question about adding Zend_Dojo_Form into Zend_layouts. I have a Zend_Dojo_Form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.