I'm trying something where I turn each element of a query into a variable so that they can be changed individually (unless somebody knows a better way). Everything seems to work until I get to the WHERE / LIKE part. When I put the $_GET variable inside the $where query variable, I get an error. But it'll work if I leave it out.
So, this works:
$where1 = ' AND descriptors.leaf_margin LIKE';
But these two do not:
$where1 = ' descriptors.leaf_shape LIKE $leafshape';
$where1 = ' descriptors.leaf_shape LIKE '%$select3%';
Here's how far I've gotten:
$leafshape = $_GET["select1"];
$leafcolor = $_GET["select2"];
$leafvein = $_GET["select3"];
$leafmargin = $_GET["select4"];
$sc = 'SELECT COUNT(*) as num';
$from1 = 'FROM descriptors';
$join1 = 'JOIN
plantae ON (descriptors.plant_id = plantae.plant_name)';
$where1 = ' descriptors.leaf_shape LIKE';
$where2 = ' AND descriptors.leaf_venation LIKE';
$where3 = ' AND descriptors.leaf_margin LIKE';
$where4 = '';
$query = "$sc
$from1
$join1
WHERE
$where1 '%$select3%'
$where2 '%$select3%'
$where3 '%$select4%'
";