I made a site a while ago for my daughters dance school.
On one page all the different styles are supposed to be listed from a MySQL database.
In the admin page she can pick 1 if a style should be listed and 0 if it shouldn’t be visible.
But when she mark it with a zero it is still showing.
What is wrong in my code here?
I made it all in Dreamweaver.
The part where she can change is called “dance_dans.listas”
"SELECT dance_kurs.dans, dance_kurs.kursnr, dance_dans.listas FROM dance_dans, dance_kurs WHERE substr(dance_kurs.kursnr, 12, 1) = '$lokal' AND dance_dans.listas = '1' GROUP BY dance_kurs.dans ASC"
Well the large table is the classes for the dance school.
The id, the number, year, term, type of dance (the related one), age group, level, courses, price, teacher, room, starts, weekday, time, active
The other table contains
The id, type of dance (the related one), comments, listed or not
to start with, it’s really really difficult to understand a query that’s all strung out on a single line – please learn to use line breaks and indents
SELECT dance_kurs.dans
, dance_kurs.kursnr
, dance_dans.listas
FROM dance_dans
, dance_kurs
WHERE substr(dance_kurs.kursnr,12,1) = '$lokal'
AND dance_dans.listas = '1'
GROUP
BY dance_kurs.dans ASC
ah, that’s better
okay, the problem is, you haven’t joined the tables properly, and you’re getting cross join effects
each of the $lokal dans_kurs rows is matched with every listas=1 row in the other table