Trädvy Permalänk
Medlem
Plats
London
Registrerad
Jul 2003

PHP MYSQL problem hjälp

Hejsan håller på med php/mysql men har kört fast mig lite.

Vill visa den sista raden i databasen där resultat har lagts till.

För tillfället visas sista raden i databasen:

$query = "SELECT gpk_team.tmName as fixTeam1, gpk_team2.tmName as fixTeam2, gpk_fixture.fixScore1, gpk_fixture.fixScore2, gpk_fixture.fixDate FROM `gpk_fixture` LEFT JOIN gpk_team ON gpk_fixture.fixTeam1 = gpk_team.tmID LEFT JOIN gpk_team as gpk_team2 ON gpk_fixture.fixTeam2 = gpk_team2.tmID order by fixscore DESC LIMIT 1";

Men vill visa sista raden där gpk_fixture.fixScore2 and gpk_fixture.fixScore1 = not null.

Trodde detta skulle funka

$query = "SELECT gpk_team.tmName as fixTeam1, gpk_team2.tmName as fixTeam2, gpk_fixture.fixScore1, gpk_fixture.fixScore2, gpk_fixture.fixDate FROM `gpk_fixture` LEFT JOIN gpk_team ON gpk_fixture.fixTeam1 = gpk_team.tmID LEFT JOIN gpk_team as gpk_team2 ON gpk_fixture.fixTeam2 = gpk_team2.tmID where fixdate = not null order by fixdate; DESC LIMIT 1"; Ifall nån kan hjälpa mig så skulle jag var jätte glad.

mvh
Joel

AMD OPTERON athlon 3800 x2. DFI LANPARTY nforce 4ULTRA D, 2x1 gig twinmos Chassi Themlake 3,3| GC = Powercoler x850 XT Vivo, Logitech G15, Aiwa surround System, NEC DVD Burner, 1 x 1 x 200 gig 1x500 gigmaxtor SATA 1, 1 x180 gig Western Digital 1x320 western

Trädvy Permalänk
Medlem
Plats
London
Registrerad
Jul 2003

Detta löste problemet :D..
where fixscore1 > 0

AMD OPTERON athlon 3800 x2. DFI LANPARTY nforce 4ULTRA D, 2x1 gig twinmos Chassi Themlake 3,3| GC = Powercoler x850 XT Vivo, Logitech G15, Aiwa surround System, NEC DVD Burner, 1 x 1 x 200 gig 1x500 gigmaxtor SATA 1, 1 x180 gig Western Digital 1x320 western

Trädvy Permalänk
Medlem
Plats
Stockholm
Registrerad
Feb 2006

NULL är lite speciellt, så man får använda "IS NULL" och "IS NOT NULL". T.ex. "WHERE fixscore1 IS NOT NULL" eller "WHERE fixscore1 IS NULL".

Dator: i7-6700K, Asus Z170 PRO gaming, Noctua NH-D15, 32GB DDR4-3000, Asus 1080ti Strix gaming OC, Seasonic Platinum 1000W, Define XL R2, Intel 750 400GB PCIE Nvme SSD, Dell U2711