Sunday, 25 August 2013

Can't fix the undefined index error

Can't fix the undefined index error

I have been surfing for a solution to this problem for awhile now and most
of what I find is that people who aren't checking to see the the $_GET
variable is set are the ones having this error. However, I do check if
they are set yet I still come up with this error. Here is my code:
$customer_id = $_GET['customer_id'];
$actual_customer_id = $_GET['actual_customer_id'];
if (isset($_GET['customer_id'])&& $_GET['actual_customer_id'])
{
$query = "SELECT rewards_points.points,customers.id AS customerID,
customers.email
FROM rewards_points,customers WHERE rewards_points.customer_id=
$customers_id AND
$actual_customer_id = rewards_points.actual_customer_id";
}
$query = "SELECT rewards_points.points,customers.id AS customerID,
customers.email
FROM rewards_points,customers";
And the error is:
Notice: Undefined index: customer_id in
/Applications/MAMP/htdocs/insertintotestt.php on line 14
Notice: Undefined index: actual_customer_id in
/Applications/MAMP/htdocs/insertintotestt.php on line 15
[{"points":"20","customerID":"1","email":"someEmail@gmail.com
{"points":"20","customerID":"2","email":"otherEmail@gmail.com"},
{"points":"10","customerID":"1","email":"aha238@gmail.com"},
{"points":"10","customerID":"2","email":"spgiegg@gmail.com"},
{"points":"15","customerID":"1","email":"aha238@gmail.com"},
{"points":"15","customerID":"2","email":"spgiegg@gmail.com"},
{"points":"25","customerID":"1","email":"aha238@gmail"},
{"points":"25","customerID":"2","email":"spgiegg@gmail.com"}]

No comments:

Post a Comment