controleren of een combinatie niet voorkomt in tabel

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Ron -

Ron -

27/09/2008 10:20:00
Quote Anchor link
ik heb 2 tabellen, 1 met alle reacties bij fotos en in 1 houd ik bij welke de gebruiker heeft gelezen
nu wil ik in 1 query achterhalen hoeveel hij NIET heeft gelezen, hoe doe ik dit?
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
$comment_query
= "SELECT photo_comments.reactionid FROM photo_comments, photo_comments_read WHERE (photo_comments.photo LIKE '".$date."%' && photo_comments_read.reactionid = photo_comments.reactionid && photo_comments_read.userid = ".$_SESSION['je_id'].")";
?>


dit heb ik dus al geprobeerd, maar zo haalt hij dus de gelezen eruit
in de query moet dus nagegaan worden of de combinatie van het session id en reaction id in de tabel photo_comments_read voorkomt

is dit mogelijk?

alvast bedankt voor de hulp!
 
PHP hulp

PHP hulp

20/04/2024 08:09:35
 
Nils Kuijpers

Nils Kuijpers

01/10/2008 11:58:00
Quote Anchor link
NOT LIKE en != gebruiken?
 
Jurgen assaasas

Jurgen assaasas

01/10/2008 12:12:00
Quote Anchor link
Nils schreef op 01.10.2008 11:58:
NOT LIKE en != gebruiken?


!= is PHP <> is SQL
 
PHP erik

PHP erik

01/10/2008 12:26:00
Quote Anchor link
&& is ook PHP, AND is SQL
 
Nils Kuijpers

Nils Kuijpers

01/10/2008 12:30:00
Quote Anchor link
dus != kan niet in een sql query? Wat is dan het alternatief?
 
- SanThe -

- SanThe -

01/10/2008 12:31:00
Quote Anchor link
Jurgen schreef op 01.10.2008 12:12:
!= is PHP <> is SQL

Lezen.
 
Ron -

Ron -

01/10/2008 13:23:00
Quote Anchor link
als ik dit doe:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
$comment_query
= "SELECT photo_comments.reactionid FROM photo_comments, photo_comments_read WHERE (photo_comments.photo LIKE '".$date."%' && photo_comments_read.reactionid = photo_comments.reactionid && photo_comments_read.userid <> ".$_SESSION['je_id'].")";
?>


dan krijg ik de reacties die de andere mensen hebben gepost, dat is dus ook niet wat ik moet hebben

ik moet checken of de combinatie van reactionid en $_SESSION['je_id'] in 1 rij voorkomt
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.