I\'m new to PHP and MySQL. I am trying to make a simple search form using which I would want to show the results from the database based on the input text entered in the form. M
You're escaping the $
in the variable by doing \$
.
Try:
$query = "SELECT * FROM `cats` WHERE name='$name'";
EDIT
From the discussion below.
The problem with the undefined index
is the fact that you are using $row['age']
when really, the column name in the database is Age
. Therefore you must use $row['Age']
when referring to the item. The same goes for name
.