Skip to content
Advertisement

PHP don’t recognize row variables

I am having trouble posting a mysql table to my website.

Basically, the php error says that the row variable that I used was undefined. I tried using a code from a youtube tutorial but to no avail.

I also checked my sql query on phpmyadmin and it seems to work just fine.

Here is my test code for your reference:

JavaScript

The error says: Notice: Undefined index: client_name in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: transaction_ID in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: transaction_date in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: website_Name in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: website_Price in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Advertisement

Answer

In PHP arrays, string keys are case-sensitive.

The DB column is Client_Name (capital C and N) but you’re asking for the array key client_name (lowercase).

Check the column names, and the corresponding keys that you’re asking for, and you’ll see the mismatch. If you var_dump($row) you should see the problem clearly.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement