I'm trying to create a search on a website I'm making for homework with a database called animal that is saved on an easy php server. However, when I run the search, the php code shows up as text. Can someone please help me with this?
<?php
$criteria = $_GET["criteria"];
$Field = $_GET["animal"];
$link = mysql_connect('127.0.0.1', 'criteria', 'animal');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$result = array(connection -> query("SELECT * FROM animal WHERE $Field Like %criteria%"));
mysql_close($link);
echo $result;
?>