I 3 Variablen aus JSON Link bin Parsen, bestehen jeweils aus Variable des Namens eines Kinotheater:php - sql Wählen Sie "wo" gleich ein paar Variablen?
$cinema1
$cinema2
$cinema3
Nach, ich brauche eine IDs aller drei Kinos aus der Tabelle zu wählen, dann, dass IDs Ich muss nach dem Tisch "movietimings" suchen, um zu sehen, ob es heute Filme gibt, wenn heute in diesen Kinos ein Film läuft, dann muss ich zum "Film" -Tisch gehen und alle Informationen über diesen Film zeigen.
Also, das ist, was erreicht worden sind:
$sql2 = "SELECT DISTINCT * FROM cinema WHERE cinemaname = '$cinema1' AND cinemaname='$cinema2' AND cinemaname='$cinema3' ";
$result2 = $conn->query($sql2);
if ($result2->num_rows > 0) {
// output data of each row
while($row2 = $result2->fetch_assoc()) {
$cinemaid2 = $row2['id'];// I have received a cinema id
//getting the main id, since the id I just got is a branch of the main cinema, so the main id that is associated with movie timings is down below
$sql5 = "SELECT DISTINCT * FROM cinemas WHERE cinemaname = '$cinemaid2'";
$result5 = $conn->query($sql5);
if ($result5->num_rows > 0) {
// output data of each row
while($row5 = $result5->fetch_assoc()) {
$cinemaid = $row5['id'];//received main id required
$today = date("m/d/Y");//getting todays date
//now trying to find if a movie today playing
$sql3 = "SELECT * FROM moviecinemashowsassociation WHERE cinemaid LIKE '$cinemaid' AND showdate LIKE '$today'";
$result3 = $conn->query($sql3);
if ($result3->num_rows > 0) {
// output data of each row
while($row3 = $result3->fetch_assoc()) {
$movieid = $row3['movieid'];// selected a movie id played today
//selecting information about movie
$sql4 = "SELECT * FROM movie WHERE id='$movieid'";
$result4 = $conn->query($sql4);
if ($result4->num_rows > 0) {
// output data of each row
while($row4 = $result4->fetch_assoc()) {
Das Problem ist, dass ich 3 verschiedene Kinos haben, die durch eine Schleife gehen sollte.
define: "funktioniert nicht" für uns bitte. Variablenwerte sind ...? DB-Schema ist was? Werte in db sind was? –
Sie müssen boolesche Logik lernen. Du sagst "das Field Cinemaname muss GLEICHZEITIG alle drei der folgenden Werte sein". Du willst ein 'oder'. "kann eine der folgenden Werte sein" –
Danke für die Antwort. Ich ändere die Frage, weil es scheint, dass ich das Problem nicht klar verstanden habe. –