Hi,
I'm working on a select statement to retrieve data, which I know(data exists) is in the MySQL DB.
Here is the part I'm working on:
(have some other code here, but that's not the issue)
I have a connection to the DB because all my other functions are working
When I run the function I get this:
sql string is:
recipe ID is:
Error: Query was empty
It's acting as if it doesn't know what my $recipeID is, and it also isn't telling me what the value of $sqlString is either. I have set recipeID session variable on another page, and on this page I'm retrieving it, yet it's empty.
I've played with the last where statement so many times, maybe I've ended up with something totally wrong. When I test it in MySQL, I replace all the variable stuff with a number and it retrieves all the data I need to see.
Hoping someone can help me.
I'm working on a select statement to retrieve data, which I know(data exists) is in the MySQL DB.
Here is the part I'm working on:
Code:
function funGetRecipeIngredientsAsTable() {
$recipeID = $_SESSION['sesRecipeID'];
$sqlString = "SELECT u.unitName, m.measureAbbrev, i.ingredientName
FROM Recipe r, RecipeIngredients ri, Units u, Measurements m, i.Ingredients
WHERE r.recipeID = ri.recipeID
AND ri.unitID = u.unitID
AND ri.measureID = Measurements.measureID
AND ri.ingredientID = i.ingredientID
AND ri.recipeID = ".$recipeID.";";
$ingredientDataResult = mysql_query($sqlString);
echo "sql string is: ".$ingredientDataResult ."<br/>";
echo "recipe ID is: " . $recipeID ."<br/>";
if (!mysql_query($ingredientDataResult)) {
die('Error: ' . mysql_error());
}
(have some other code here, but that's not the issue)
I have a connection to the DB because all my other functions are working
When I run the function I get this:
sql string is:
recipe ID is:
Error: Query was empty
It's acting as if it doesn't know what my $recipeID is, and it also isn't telling me what the value of $sqlString is either. I have set recipeID session variable on another page, and on this page I'm retrieving it, yet it's empty.
I've played with the last where statement so many times, maybe I've ended up with something totally wrong. When I test it in MySQL, I replace all the variable stuff with a number and it retrieves all the data I need to see.
Hoping someone can help me.
Comment