Wuu Posted March 14, 2009 Report Share Posted March 14, 2009 (edited) Struktūra create table forum_ref (ip INT UNSIGNED PRIMARY KEY, id INT, addtime TIMESTAMP); Šis query vienreiz pievieno ,bet otrreiz negrib met erroru 1062: Duplicate entry '1357505893' for key 1 insert into forum_ref values (INET_ATON("'.$ip.'"),'.$id.',NOW()); Šis quary neko neatgriež kaut arī ieraksts no ip ir! select count(ip) from forum_ref where ip = INET_ATON("'.$ip.'") limit 1; Citu erroru nav! Edited March 14, 2009 by Wuu Quote Link to comment Share on other sites More sharing options...
marcis Posted March 14, 2009 Report Share Posted March 14, 2009 Jāņem vārdnīca palīgā - lauks ip tev ir primārā atslēga, kas nozīmē, ka divu vienādu atslēgu nevar būt. Tu centies pievienot ierakstu ar tādu pašu atslēgu, kāda jau eksistē, tāpēc mysql bļaustās. SELECT COUNT(*) FROM `tabula` WHERE ip=INET_ATON('$ip') Quote Link to comment Share on other sites More sharing options...
Wuu Posted March 14, 2009 Author Report Share Posted March 14, 2009 Paldies!!! Un vel jautājums delete from forum_ref where DATE(addtime) < CURDATE(); Erroru neatgriež ,bet vai strādās nezinu jo varēs pārbaudīt tik pēc 12 nakti! Kā lai pārbauda? Quote Link to comment Share on other sites More sharing options...
Kavacky Posted March 14, 2009 Report Share Posted March 14, 2009 Pagriez pulksteni datorā. Quote Link to comment Share on other sites More sharing options...
Wuu Posted March 14, 2009 Author Report Share Posted March 14, 2009 Nevaru nav privilēģiju :D Quote Link to comment Share on other sites More sharing options...
bubu Posted March 14, 2009 Report Share Posted March 14, 2009 Aizstāj CURDATE() ar konkrētu datumu - pēc tiem 12-tiem naktī. Un testēt nevajag uz produkcijas servera - vajag testēt uz atsevišķa developēšanas servera, kuram tev būs visas privilēģijas, kādas tik vien kārosi. Quote Link to comment Share on other sites More sharing options...
Wuu Posted March 15, 2009 Author Report Share Posted March 15, 2009 Strādā no rīta paskatījos :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.