Jump to content
php.lv forumi

draugiem lv, info kaut kas jauns


goma smile

Recommended Posts

Glabā kaut kur datumu, kurā lietotājs ir pēdējo reizi iegājis galerijās.

 

Pēc tam atlasi, cik galerijas ir pārādījušās pēc šī laika.

 

Ieejot galerijās:

 

UPDATE user SET last_gallery_visit = NOW() WHERE id = $user_id

 

last_gallery_visit ir datetime tipa lauks.

 

Tad, lai dabūtu skaitu cik ir jaunas galerijas:

 

SELECT COUNT(*) FROM galleries WHERE date_gallery_created > $last_gallery_visit AND user_id IN (SELECT friend_user_id FROM friends WHERE user_id = $user_id)

 

Nav testēts, bet domai vajadzētu būt skaidrai.

 

Ir, protams, citi varianti, kurus var lietot, ja ir ļoti daudz lietotāji, bet šis ir tāds vienkāršākais, manuprāt.

Edited by briedis
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...