I am trying to use variables in a MySql query but can't get it to work. Here is my query. I've printed some of the variables so that I know there are the correct values in my variables.
Code: Select all
$selectedVerb = $_POST['selectedVerb'];
$selectedTense = $_POST['selectedTense'];
echo "<br>$selectedVerb</br>";
echo "<br>$selectedTense</br>";
$query = 'select * from conjugats where verbID = $selectedVerb and tenseID = $selectedTense';
echo "<br>$query</br>";
As you can see the query isn't using the values that are in the variables, but using the variable name. Any ideas how I get to the actual values in the variables?4
2
select * from conjugats where verbID = "$selectedVerb" and tenseID = "$selectedTense"
No rows found
Thanks,
Tim.