Fatal error: Call to a member function fetch_object() on a non-object

When coding, it is always advisable you check code to make sure the syntax are correct as majority of bugs arises from it. If you are using an Integrated development environment (IDE) such as NetBeans, Dreamweaver or Aptana Studio, you are notified when there is (syntax) error in your code. While working on a CMS I was building for a client, I encountered this PHP / MySQL error;

Sponsored Links:

Related Topics

Increase "memory_limit" value using php.ini
Sometimes your scripts will consume a lot of memory. Lack of it may cause in PHP throwing a fatal error with something like this below: Fatal error:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 103 bytes).
The amount of bytes may be different but rest will be the same. To prevent it, you should increase value set in variable called “memory_limit”. You can do it in more than one way.

PHP Upload Function
Uploading a file using PHP is not a single step function. To make this easier, I have created a function that will upload a file with just one function call. Just upload('image'); and the file is uploaded! upload() is a function that makes uploading files very easy.

Learn how to define your own function and how to call a function. You'll also learn the variable scope.

Introduction to PHP Exceptions
With the advent of PHP 5 came the new OO model and a new Object Oriented approach of dealing with errors. Exceptions give us much better handling of errors an allow us to customize the behavior of our scripts when an error (Exception) is encountered. Previously PHP dealt with errors by having error flags from functions and the trigger_error() function. These were well and good for pre-php5 days but in the new OO environment we need greater control.

PHP json_last_error() function
While working on encoding or decoding JSON, if an error occurres, json_last_error() function returns the last error.

Complete advanced login member system
this advanced tutorial will teach you the steps required to create a custom build login/member system with PHP.

PHP Array Length using count or sizeof
PHP Array Length can be measured by using either count function or sizeof function in php. both functions will work same, sizeof function is an alias of count function. By using this count function in PHP, you can measure PHP Array Length. Counts all elements in an array, or something in an object and returns numeric value. It takes two argument, first argument is the array and it is required.

Object Oriented Programming
This tutorial covers the following:
* The drawbacks to standard function libraries and how object-oriented programming helps to solve them
* How to declare, implement, and use classes in PHP5
* How to extend classes
* How to create hierarchies of related classes that share implementation and classes that expose common programming 'interfaces'
* Some of the other details and features of classes in PHP

Debugging PHP: Did You Remember to
So you've finally managed to install PHP. Anxious to use your new tool, you find the print function in the manual, write your own hello world, load the page and the dreaded "Parse error: parse error in /usr/local/apache/htdocs/test.php on line 2" error pops up in front of you. You know the scenario, read on to learn the fixes....

Object Oriented Programming With PHP
First off, an object (also know as a class) is a very simple section of code that has a section of its own variables and functions. In a simple way an object is kind of like a program itself. Objects can be used for many different things as they are very expandable. What an object is capable of doing is entirely up to the developer. A class can be used for things as simple as creating a link and or to store data loaded from a file and or SQL query.

Object-Oriented PHP for Absolute Beginners
This tutorial introduces you to object-oriented programming in PHP. You'll explore the basics of object-oriented programming, and learn how to write simple object-oriented PHP scripts.

PHP Function
When you have a set of variables or want to make your code simpler, you will use a function. Creating a function is really easy.

Copying an object in PHP with clone
Objects in PHP are assigned by reference, so copying an object with the = operator will result in a second variable referencing the same object and not an actual copy.

PHP Date Function Hints and Tips
We are going to learn how to use the PHP Date function. It really is a simple function, but there are a lot of parameters that can be used which may make it harder for people to catch on to right away. I hope that with this tutorial, it will make the function a little easier to understand by providing visual examples.

Lambdas Anonymous Functions Closures With PHP
With the advent of PHP 5.3 came Anonymous Functions. Quite often referred to as Lamdas or Closures. In PHP, these are essentially all the same. Any anonyymous function created using the use() keyword is a closure. In PHP, an Anonymous Function are functions that are values. What this means is that a function can be assigned to a variable. Not just the result of a function, but the whole function itself.

Sending queries to mySQL
PHP send quesries to mySQL using mysql_query function. mysql_query function returns boolean (True or False) value which your quesry does not return any records. Queries (sql statements) like SELECT, SHOW, DESCRIBE, EXPLAIN return false value on error. If query is true, returning value must pass to mysql_fetch_array().

Passing Data
The usefulness of functions is greatly enhanced by the ability to pass information from the main body of code to the function and in the opposite direction, or between one function and another it is calling Values that are sent to a function are called arguments.

Learning Functions
A function is a block of code which can be called from any point in a script after it has been declared. It is basically a compartmentalized PHP script designed to accomplish a single task. Furthermore, code contained within functions is ignored until the function is called from another part in the script. Functions are useful because they contribute to rapid, reliable, error-reducing coding, and increase legibility by tiding up complicated code sequences.

Recursion in PHP
A recursive function is just a function that calls itself. In order to make a recursive function not explode all over itself, though, it is important to keep some ideas in mind.

Currency Format Tutorial
In this tutorial we use the money_format function which is part of the STL in PHP. This function wraps the C library function strfmon() and is only available on Unix/Linux systems. Windows users should use number_format()