[PHP] Geen gegevens dan melding.

Gestart doorOne2xs17 reacties30 weergaven

18 berichten · pagina 1 van 2

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Als er geen kolommen met gegevens in de database staan moet hij een melding geven, maar ik heb echt geen flauw idee hoe dit kan, hier is het script:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]@[/COLOR][URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]*****[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]*****[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]*****[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);
@[/COLOR][URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]*****[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$qLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reports"[/COLOR][COLOR= #007700]);[/COLOR] 
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$aLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700])) 
{[/COLOR] 
?>
#<?=$aLid[id]?> | <?=$aLid[berichtid]?><hr>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/mysql_free_result"]mysql_free_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]);[/COLOR] 
?>
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
mysql_num_rows(); ?
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Thommity schreef:
mysql_num_rows(); ?
Dat begrijp ik maar hoe moet je dat gebruiken??
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
if(mysql_num_rows($qLid) == 0 ){
// melding
}

? yummie
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Thommity schreef:
if(mysql_num_rows($qLid) == 0 ){
// melding
}

? yummie
redfaceredface dat had ik ik had alleen geen
echo ;


faal yummie
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
WAAROM Doe maar niet, sommige hosts ondersteunen dit niet.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Maartenl schreef:
WAAROM Doe maar niet, sommige hosts ondersteunen dit niet.
one2xs wel wink
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Eerdere citaten tonen
Maartenl schreef:
WAAROM
Doe maar niet, sommige hosts ondersteunen dit niet.

one2xs wel wink
Dus omdat ik schrijffouten maak, en jij deze verstaat, moet ik er niks aan doen ?
Tuurlijk wel smileAls je het leert, moet je het goed leren.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
dus ik moet het zo doen van jou:

[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$aLid[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]][/COLOR] ?>
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Nee ; ?>
En leer uitlijnen
0
Berichten
1.871
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hier is een stuk voorgekauwde code:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]@[/COLOR][URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]*****[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]*****[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]*****[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);
@[/COLOR][URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]*****[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$db_error_msg[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$qLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM reports"[/COLOR][COLOR= #007700]);[/COLOR] 
[COLOR= #0000BB]$qNum[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qNum[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geen berichten :D[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$aLid[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700])) 
{[/COLOR] 
?>
#<?=$aLid[id]?> | <?=$aLid[berichtid]?><hr>
[COLOR= #0000BB]<?[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/mysql_free_result"]mysql_free_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$qLid[/COLOR][COLOR= #007700]); 
}[/COLOR]
?>


A.U.B.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
En voeg foutafhandeling toe.....
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
En voeg foutafhandeling toe.....
Ik wist dat jij dat zal zeggen yummie
0
Berichten
5.897
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Eerdere citaten tonen
Aarclay schreef:
En voeg foutafhandeling toe.....
Ik wist dat jij dat zal zeggen yummie
Doe het dan ook emo
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Eerdere citaten tonen
Aarclay schreef:
En voeg foutafhandeling toe.....
Ik wist dat jij dat zal zeggen yummie
Ik praat niet voor de kat zijn viool. Doen dus....
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