Fatal error: Cannot redeclare class User - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Fatal error: Cannot redeclare class User (/showthread.php?tid=50730) |
Fatal error: Cannot redeclare class User - El Forum - 04-06-2012 [eluser]SamoualSys[/eluser] Fatal error: Cannot redeclare class User in C:\xampp\htdocs\test\application\models\user.php on line 36 i have this error msg with white screen my model code is Code: <?php my controler code is Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Fatal error: Cannot redeclare class User - El Forum - 04-06-2012 [eluser]SamoualSys[/eluser] i have thought it may be becouse i use the same name of the controler and the model name so i change the name of the model to user_model but now it give me this error msg in all my application Code: Unable to locate the model you have specified: user Fatal error: Cannot redeclare class User - El Forum - 04-06-2012 [eluser]Samus[/eluser] [quote author="SamoualSys" date="1333706535"]i have thought it may be because i use the same name of the controler and the model name so i change the name of the model to user_model but now it give me this error msg in all my application Code: Unable to locate the model you have specified: user Yes that was the initial problem. But you don't seem to have changed the model file name, it needs to correspond with the class name too. so if your model file name is now 'user_model' your model class name should be 'User_model' Fatal error: Cannot redeclare class User - El Forum - 04-06-2012 [eluser]InsiteFX[/eluser] I think you need to learn PHP before trying to tackle CodeIgniter! Fatal error: Cannot redeclare class User - El Forum - 04-07-2012 [eluser]SamoualSys[/eluser] thanks insiteFX i am trying to learn php i have read some book and iam using codeigniter to learn coding in with this error i have learn alot i have fix my error but dont ask me how from trying i have make it work . as i remmber i change the controller name to users and it worked . Fatal error: Cannot redeclare class User - El Forum - 04-07-2012 [eluser]InsiteFX[/eluser] You can only have one class name! Your error is stating that you are trying to load the same class a second time check your code.. |