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 8572959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:08:34+00:00 2026-06-11T19:08:34+00:00

I am using objects in php. I have an object to connect to database

  • 0

I am using objects in php. I have an object to connect to database server $con object and $opt (operation) object to send query to database server, till now there is no problem, the problem is that I defined the $con object as static and I defined it in $opt object as it shows in below code

  class operations{

   public static $con = null;
   public function __construct($tableName = null){

     // Creating  an object of connection 
     self::$con = new config();
     self::$con = self::$con->getConnection();
   }

  } 

So when I want to call the $con object there is no problem

mysql_query($query,$opt::$con) or die (mysql_error());  

but on server it appears with this error

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
  • 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-11T19:08:35+00:00Added an answer on June 11, 2026 at 7:08 pm

    Your scope resolution is unexpected, that means that you use it in a bad context.
    When do you use “::”? After self static, classname or a string representing the name of a class :

     static::PropertyOrMethod;
     self::PropertyOrMethod;
     CLassName::PropertyOrMethod
     $string = "className";
     $string::PropertyOrMethod
    

    Instead of that, you use it over ans instance of your class and php does not like it.
    You should use
    mysql_query($query,operations::$con) or die (mysql_error());

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

Sidebar

Related Questions

I would love to sort an embedded MongoDB object using PHP Lithium. I have
I want to create JSON object using tow query in PHP , Then retrieve
using jquery's .post i send do my php code an object that with var_dump
I am using php to connect to my ms sql server. I am using
I've to work with a ingres database for my php server. I just have
I'm trying to connect to SQL Server using PHP, I'm learning this language. I
I have the following code that suppose used to Send Data to Server using
I use object buffering to buffer the output of my php pages using ob_start('ob_gzhandler');
I just started using mysqli API for PHP. Apparently, every time an object of
I'm creating a JSON object like tags = {jon:[beef,pork],jane:[chicken,lamb]}; which was generated using php

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.