For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Monday, May 11, 2015

Message: Undefined variable: 0 in CodeIgniter PHP

Problem:

Sometime while working with CodeIngiter / PHP you may encounter "Undefined variable: 0" error.
It surprise to that is "0" (Zero) could be a variable!

Solution:

This "Undefined variable: 0" error come when you use double dollar sign in variable. so remove one dollar ($) sign from variable and error will gone.

Example:

See the below code, specially in red color, it having $$ sign:

$data = array( 'u_login' => $row->u_login,
                        'user_type_id' => $user_type_id,
'user_id'=>$row->user_id,
'transporter_id'=>$transporter_id,
'limit_cr'=>$limit_cr,
'u_c_date'=>$row->u_c_date,
'total_trucks'=>$total_trucks,
'total_liter'=>$total_liter,
'pump_id'=> $$pump_id
                        );

jut remove one $ sign.
Share:

0 comments:

Post a Comment

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip