voldemarz Posted May 13, 2006 Report Share Posted May 13, 2006 Nevaru saprast kur seit ir kluuda: $res = mysql_query("select * from readings where '$vakar+24*3600'<unix_timestamp(time) and unix_timestamp(time)<'$vakar+25*3600'"); Sitaads variants straadaa: $res = mysql_query("select * from readings where '$vakar+24*3600'<unix_timestamp(time)"); Link to comment Share on other sites More sharing options...
bubu Posted May 13, 2006 Report Share Posted May 13, 2006 Kāpēc lai tur būtu kļūda? Link to comment Share on other sites More sharing options...
voldemarz Posted May 13, 2006 Author Report Share Posted May 13, 2006 (edited) Taapeec, ka sitaads variants piemeeram straadaa, nolsa visu liidz tabulas beigaam, saakot ar vajadziigo vietu: $res = mysql_query("select count(*) from readings where unix_timestamp(time)-'$vakar+24*3600'>0"); $sk = mysql_fetch_array($res); echo "$sk[0]"; ---------------------------------------------------------------------------------------------------------------------- Bet sitaads, skaitu izvada 0, kaut gan mekleejamajaa intervaalaa ieraksti ir pilniigi noteikti: $res = mysql_query("select count(*) from readings where unix_timestamp(time)-'$vakar+24*3600'>0 and unix_timestamp(time)-'$vakar+25*3600'<0"); $sk = mysql_fetch_array($res); echo "$sk[0]"; No saakuma meeginaaju sitaa (tas pats, tik savaadaak pierakstiits), bet negaaja, domaaju, ka kaut kaadas sintakses kluudas. $res = mysql_query("select count(*) from readings where '$vakar+24*3600'<unix_timestamp(time) and unix_timestamp(time)<'$vakar+25*3600'"); $sk = mysql_fetch_array($res); echo "$sk[0]"; Edited May 13, 2006 by voldemarz Link to comment Share on other sites More sharing options...
bubu Posted May 13, 2006 Report Share Posted May 13, 2006 Sintakses kļūdas vajag pārbaudīt ar mysql_error(). Jautājums - kāpēc tu tos timestamp skaitļus liec pēdiņās ' ? Tev kolonnas tips ir tekstuāls? Link to comment Share on other sites More sharing options...
voldemarz Posted May 13, 2006 Author Report Share Posted May 13, 2006 Saķīlēju ;) Pedinaas taapeec, ka man ieprieks kkur bija taa, ka bez apostrofiem negaaja. Laikam seit: $res = mysql_query("select * from readings where '$tagad'-unix_timestamp(time)<=$starp"); Datbuaazee, tajaa time kolonaa ir datetime tipa mainiigie, eertaak buutu, ja tur buutu timestamp, bet tur neko nevar mainiit. ;) Noneemu sitam peedinas un aizgaaja: $sk_res = mysql_query("select count(*) from readings where $vakar+24*3600<unix_timestamp(time) and unix_timestamp(time)<$vakar+25*3600 "); Link to comment Share on other sites More sharing options...
Recommended Posts