MySQL Forums
Forum List  »  PHP

Re: Problem with Database workout
Posted by: druckgott
Date: May 18, 2005 03:19AM

hallo

so this is my new script

[PHP]
<?php

@error_reporting(7);

/** connect db **/
require("config.inc.php");
require("class_db.php");

$db = new db($mysqlhost,$mysqluser,$mysqlpassword,$mysqldb);

$id=1; //die ID des ausgewählten cocktails, z.B. über $_GET erhalten

$res = mysql_query("SELECT zutat_id AS zId,
zutat_name AS zName,
cocktail_id AS cId,
cocktail_name AS cName
FROM zutat_mehr
LEFT JOIN cocktailZutaten_mehr ON ( zutat_id = cocktailZutaten_mehr.z1_zutatId)
LEFT JOIN cocktail_mehr ON ( cocktail_id = cocktailZutaten_mehr.cocktailId )
WHERE zutat_id ='".mysql_escape_string($id)."'");

$firstRow=true; //Hilfsvariable
$data=array();//damit es auch nach der Schleife noch existiert
while ($row=mysql_fetch_assoc($res)) {
$data=$row;
if ($firstRow) {
$firstRow=false;
echo "<h2>Zutat:</h2>";
echo "".$row['zName']."";
echo "<h2>Cocktail:</h2>";
echo "<ul>";
}
echo "<li>".$row['menge']." ".$row['cName']."</li>";
}
// echo "</ul>";
// echo "<h2>Rezept</h2>";
// echo "<p>".$data['rezept']."</p>";
// echo "<h2>Kommentar</h2>";
// echo "<p>".$data['kommentar']."</p>";
?>
[/PHP]

now it give me out if i have added 1 what cocktails added 1 include but I want to have the cocktails who I can mixx if i have added 1 and added 2

I have changed the tabell "zutat"
it include cocktailID and z1_zutatID and z2_zutatID but I don´t know how I can do it that the script give me out the cocktails I can mixx if i have z1_zutat and z2_zutat now it gives me out the cocktails who have this added include

zutat = added that you know this *g*

I hope anybody can help me!!!

thx druckgott

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem with Database workout
May 18, 2005 03:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.