I'm working on a big project for several car companies,developing and taking care of the site. The problem is that I came on already done site,which btw is written terribly,but aside from that,there are many rules that need to be there in order for the site to work.
The data is stored in DB,and with sql statements I take that data to the site,do stuff with and eventually show it on the screen. Mostly,i just convert the mysql resultset to an array and through foreach loop i show them in the table. And here comes the problem, every row has its status, and the data is shown by its status (example:if status
is 20
, it's not shown on the screen, but if the status
is 1
then that row is shown) except one status. It has 2 terms that need to be fullfilled in order for him to show. If the status=8
and DATE_ADD(column1,INTERVAL + 30 day)>CURDATE()
it is shown. But that doesn't work. The row with status 8 is always shown. How do i prevent him from not showing at all .I have PHP if loop in my script that says
if($value[11]==8 and $value[21]>$value[22] ){
$value[11]=50//not shown;
}
but that also doesn't work. ($value[11]=status
$value[21]=DATE_ADD part
and $value[22]=CURDATE()
)
Please help.Thx in advance
SELECT d1.VIN, d1.brand, d1.make_fin, DATE_FORMAT( d1.dat_ser ,'%d.%m.%Y'),
d1.Partner, d1.adress , d1.mail, d1.place, d1.Tel,d1.Mob, d1.uniq,
d1.idm01_statusi_a,d2.statusname , d1.EMail , DATEDIFF(CURDATE() , d1.dat_ser),
d1.dat_ser, DATEDIFF(table2.OdgovorDtm, CURDATE() ) , d1.ID_p01, d2.colro, d2.font_color,
d1.ID_p01,CURDATE(),
DATE_ADD(table2.OdgovorDtm,INTERVAL + 30 DAY),
table2.OdgovorDtm
FROM table1 as d1 INNER JOIN table2
ON d1.ID_p01 = table2.ID_p01
LEFT JOIN m01_statusi_a as d2
ON d1.idm01_statusi_a = d2.idm01_statusi_a
WHERE orgidf in(SELECT d3.orgid FROM u1_org d1 INNER JOIN table3 d2 ON
( d1.idu1 = d2.idu1 ) INNER JOIN lo360.u1_org d3 ON
( d2.idu2 = d3.idu1 ) where d1.orgid = 'HR11338')
and d1.idm01_statusi_a in (1, 2, 3, 4, 5, 6, 7,8,9 )
and 1 = 1 and 1 = 1 and 1 = 1 and 1 = 1 and d1.IDBRAND in
( 1, 2, 3 ) and 1=1 ORDER BY d1.dat_ser ASC LIMIT 0, 25