473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Host config broke my code, please help.

Tarantulus
114 100+
Hi Guys/Girls,

I have been coding a website for a friend, everything worked fine on my localhost setup, then I FTP to their host and now it's broken....

the error is

Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition cart of the object you are trying to operate on was loaded _before_ the session was started in /index.php on line 40

line 40 of index.php is
Expand|Select|Wrap|Line Numbers
  1. $cart -> add($id,$qty,$price);
and the necessary function is
Expand|Select|Wrap|Line Numbers
  1. function add($prod_id,$qty,$price) {
  2.  
  3.  
  4.             session_start();
  5.  
  6.  
  7.             if (isset ($_SESSION['cart'][$prod_id])){
  8.                 $_SESSION['cart'][$prod_id]['qty'] += $qty;
  9.             } 
  10.             else{
  11.                 $_SESSION['cart'][$prod_id] = array("qty"=>$qty,"price"=>$price);
  12.  
  13.             }
  14.  
  15.  
  16.     }
can someone point out what I've done wrong??
Jun 3 '08 #1
5 1492
pbmods
5,821 Expert 4TB
Heya, Tarantulus.

'Incomplete Class' generally refers to a PHP-4-style class on a PHP 5 installation. Check your phpinfo() output and verify your friend's PHP version.
Jun 4 '08 #2
Tarantulus
114 100+
Heya, Tarantulus.

'Incomplete Class' generally refers to a PHP-4-style class on a PHP 5 installation. Check your phpinfo() output and verify your friend's PHP version.
funnily enough I have PHP 5.x and the host has 4.x AND 5.x but runs 4.x as default, which is where I first saw the error. this error comes up since I changed the .htaccess to use 5.x.
Jun 4 '08 #3
Tarantulus
114 100+
funnily enough I have PHP 5.x and the host has 4.x AND 5.x but runs 4.x as default, which is where I first saw the error. this error comes up since I changed the .htaccess to use 5.x.
I just realised this post makes it sound like the problem was solved.

I should say that it is broken in both PHP4 and PHP5, however the specific error I mentioned is with PHP5.

it's driving me insane as it works on my PHP5 install without a hitch!
Jun 4 '08 #4
pbmods
5,821 Expert 4TB
According to this comment:

You get this error if you have and object in your $_SESSION array and you call session_start() before you have loaded your included classes.

Try implementing an autoloader.
Jun 4 '08 #5
Tarantulus
114 100+
thanks for the pointers, turns out there was no problem with my code though... re-uploaded and it worked.

thanks again
Jun 5 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: n3crius | last post by:
hi, i just got a web host with asp.net , seemed really cool. aspx with the c# or vb IN the actual main page run fine, but when i use codebehind and make another source file ( a .cs) to go with...
2
by: Anna | last post by:
I added a small Web.Config file to the root of my website so that I could view errors on a machine other than the server: <configuration> <system.web> <customErrors mode="Off" /> </system.web>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.