Undefined Index Error in PHP & MYSQL
-
I am getting the error - "Undefined Index Job_Code, Account_Code, welfare_tag & Amount" in the following code (PHP & MYSQL). while($rs=mysql_fetch_array($result,MYSQL_BOTH)) { $Job_Code=$rs["Job_Code"]; $Account_Code=$rs["Account_Code"]; $welfare_tag=$rs["welfare_tag"]; $Amount=$rs["Amount"]; }
-
I am getting the error - "Undefined Index Job_Code, Account_Code, welfare_tag & Amount" in the following code (PHP & MYSQL). while($rs=mysql_fetch_array($result,MYSQL_BOTH)) { $Job_Code=$rs["Job_Code"]; $Account_Code=$rs["Account_Code"]; $welfare_tag=$rs["welfare_tag"]; $Amount=$rs["Amount"]; }
first off: $row = mysql_fetch_assoc($res); $job_code = $row['job_code']; $account_code = $row['account_code']; $welfare_tag = $row['welfare_tag']; $amount = $row['amount']; is a neater way to write the code ;) i think ur error is coming in from the case of the variable names ... always use lower case for everything ... it makes life simpler in the long run trust me :)