I have a problem with defining php script for my databases and two tables, RecipeDB and IngredientDB my php script seems not to display content of db. I try connect two tables with RecipeID which is primary key. But for some reason doesn't work when I write query for simple table it works but not with two tables please help me thanks in advance
$conn = mysql_connect("...") or die(mysql_error());
mysql_select_db("a7956343_FoodP", $conn);
$sql = 'SELECT * FROM `RecipeDB`, `IngredientDB` WHERE
`RecipeDB.RecipeID`=`IngredientDB.RecipeID`';
$xml = new XmlWriterer();
$xml->push('recipes');
if ($result = mysql_query($sql))
{
while($Recipe = mysql_fetch_row($result))
{
$xml->push('Recipe');
$xml->element('RecipeID', $RecipeDB[0]);
$xml->element('Name', $RecipeDB[1]);
$xml->element('Category', $RecipeDB[2]);
$xml->element('Origin', $RecipeDB[3]);
$xml->element('Recipe', $RecipeDB[4]);
$xml->element('Image', $RecipeDB[5]);
$xml->element('Favorite', $RecipeDB[6]);
$xml->element('Image', $RecipeDB[7]);
$xml->element('Ingredient', $IngredientDB[8]);
$xml->element('Quantity', $IngredientDB[9]);
$xml->pop();
}
}
All you need's change the class name of ' XmlWriterer()
' in it's file.php! Hope that'll help!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.