[PHP] Ifelse werkt niet

Gestart doorBengt4 reacties30 weergaven

5 berichten · pagina 1 van 1

Bengt

Lid · Topicstarter

Berichten
803
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo,

Ik ben bezig met een reclame scriptje en wil dat als een lid voor de eerste keer inlogt hij dit ziet:
"Om door te gaan moet je op de onderstaande reclame banner klikken:
RECLAMEBANNER"

en bij else:"Succesvol ingelogd, u word doorverwezen"

Maar hij laat altijd de IF zien..

Code:

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]includes/config.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT uId,reclame FROM leden_leden WHERE uId = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]leden[COLOR= #007700]->[/COLOR]info[COLOR= #007700][[/COLOR][COLOR= #DD0000]mijn[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]

[COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$rij[/COLOR][COLOR= #007700]->[/COLOR]reclame[COLOR= #007700]);[/COLOR]


[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$id[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Om door te gaan moet je op de onderstaande reclame banner klikken:<br>"[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]reclame.php[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE leden_leden SET reclame=1 WHERE
                                        uId = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$core[/COLOR][COLOR= #007700]->[/COLOR]leden[COLOR= #007700]->[/COLOR]info[COLOR= #007700][[/COLOR][COLOR= #DD0000]mijn[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #DD0000]uId[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR]or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]()); 

}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Succesvol ingelogd, u wordt door verwezen"[/COLOR][COLOR= #007700];
}[/COLOR]
?>


-Bengt
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik weet niet zoveel van php maar moet je niet eerst controleren of reclame van dat lid de waarde 1 heeft zoniet dan krijg je die else om op de banner te klikken. Dus andersom?
0
Bengt

Lid · Topicstarter

Berichten
803
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik snap niet wat je bedoeld..
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je werkt met een class zo te zien..
als je $rij->reclame oproept, voert hij dan ook automatisch een mysql_fetch_object of array uit ?

anders moet je boven $id dit nog neerzetten:

$rij = mysql_fetch_object($query);

dan id even laten echoën om te kijken of er ook een numerieke waarde word gestuurd
0
Bengt

Lid · Topicstarter

Berichten
803
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dankjewel. it works!!
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren