MySQL Forums
Forum List  »  PHP

Problem with Database workout
Posted by: druckgott
Date: May 18, 2005 12:42AM

Hallo I have a PHP script like this:

[PHP]
<?php
//gibt aus was alles vorhanden ist
for ($i=0; $i<5; $i++)
{
$getrank = $_POST['select'][$i];

if ($getrank == 1)
{ $zutat1 = "vodka";}
if ($getrank == 2)
{ $zutat2 = "gin";}
if ($getrank == 3)
{$zutat3 = "bull";}
if ($getrank == 4)
{$zutat4 = "saft";}
}

//Cocktails und Zutaten
$cocktail1 = "Cocktail1";
$cocktail2 = "Cocktail2";
$cocktail3 = "Cocktail3";
$cocktail4 = "Cocktail4";
$cocktailzut1 = ($zutat1 == "vodka" AND $zutat2 == "gin" AND $zutat4 == "saft");
$cocktailzut2 = ($zutat3 == "bull" AND $zutat4 == "saft");
$cocktailzut3 = ($zutat1 == "vodka" AND $zutat4 == "saft");
$cocktailzut4 = ($zutat1 == "vodka" AND $zutat2 == "gin");


//Testet die Cocktails die man mixxen kann
if ($cocktailzut1)
{
echo "$cocktail1<br />\n";
}
if ($cocktailzut2)
{
echo "$cocktail2<br />\n";
}
if ($cocktailzut3)
{
echo "$cocktail3<br />\n";
}
if ($cocktailzut4)
{
echo "$cocktail4<br />\n";
}

?>
[/PHP]

now I want to have with with a mysql database can anyone help me because I have no knowing about mysql.

If you put in your names of added it will give you out the cocktail you can mix.

I have three tabels

the first one is "cocktail"
there are every cocktail have an ID
the cocktail_name

the second one is "zutat"
there is an ID and the name of the added

the third one is "cocktailzutaten"
there are the ID of the Cocktail from "cocktail" DB
and there are the ID of the Zutat1 from "zutat" DB
and there are the ID of the Zutat2 from "zutat" DB
go on to
and there are the ID of the Zutat15 from "zutat" DB
but it have not alle be fill

I hope you can help me.

thx
druckgott

Options: ReplyQuote


Subject
Written By
Posted
Problem with Database workout
May 18, 2005 12:42AM


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.