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

  • Home
  • SEARCH
  • 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 8726809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:19:24+00:00 2026-06-13T08:19:24+00:00

I have tried to print values of my PHP object ‘$mon’ which is having

  • 0

I have tried to print values of my PHP object ‘$mon’ which is having average of all months…..

and My code for data fetch is as

$result = mysql_query("SELECT b_year, sum(m1) as m1, sum(m2) as m2, sum(m3) as m3, sum(m4) as m4, sum(m5) as m5, sum(m6) as m6, sum(m7) as m7, sum(m8) as m8, sum(m9) as m9, sum(m10) as m10, sum(m11) as m11, sum(m12) as m12  
            from s_budgets as b INNER JOIN users as u on b.u_id = u.id WHERE b_year=YEAR( CURDATE( ) )
GROUP BY b_year " );
$mon=mysql_fetch_array($result)

and my code for Displaying those values are as below….

 <?php echo $mon->m4;?>,
 <?php echo $mon->m5;?>,
 <?php echo $mon->m6;?>,

how can I print the object ‘$mon’ with its several properties?

  • 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-13T08:19:25+00:00Added an answer on June 13, 2026 at 8:19 am

    $mon isn’t an object because mysql_fetch_array fetches an array from a MySQL resource. You’ll have to access your array like so:

    <?php echo $mon['m4']; ?>,
    <?php echo $mon['m5']; ?>,
    <?php echo $mon['m6']; ?>,
    

    You’ll need to use mysql_fetch_object if you’re wanting an object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble making python print out texts properly aligned. I have tried everything
Suppose $2 is my variable. I have tried going from awk -F\, '{print $2
I have tried many permutations but they all don't seems to work well. Am
Using Php I have wrote the drop down list box code. for Edit employee
I have the following simple mysqli php application, which should work fine. $pk is
I have my index.php page that sends values over to edit.php via $_GET/html link.
I have tried using the following code to try and only enter a unique
I have tried connecting with php to my database but have been completely unsuccessful
I have tried reading multiple tutorials, the PHP documentation and have no idea what
Have tried to find solutions for this and can't really come up with anything.

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.