Echo vraag.

Gestart doorVerkado25 reacties38 weergaven

26 berichten · pagina 1 van 2

Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik wil in mijn script hebben als iets niet is gevonden dat het aangegeven wordt.

Bijv; Artiest bestaat niet

Hoe plaats ik de echo bij de volgende code confused
[COLOR= #0000BB]<?
$sql[/COLOR]             [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nederhop` ORDER BY naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$artiest8[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]
?>
0
Berichten
450
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?
$sql[/COLOR]             [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nederhop` ORDER BY naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$artiest8[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Arties niet gevonden</a>"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dat werk niet dan geeft tie aan:

Quote:
Parse error: syntax error, unexpected T_ELSE in /home/faouzi01/domains/imaghreb.nl/public_html/index@h.php on line 331
0
Berichten
450
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
wat staat op line 331
0
Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
}else{
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar je wil dus een bericht laten zien als er niks in de tabel nederpop staat?
0
Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jep
0
Berichten
450
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
probeer eens dit eentje van dit moet het zijn..

Ja luuk hij wilt een echo als er niks gevonden is in het database die het colum ophaalt

[COLOR= #0000BB]<?
$sql[/COLOR]             [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nederhop` ORDER BY naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$artiest8[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){
        }
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Arties niet gevonden</a>"[/COLOR][COLOR= #007700];
    }
}[/COLOR]
?>


OF

[COLOR= #0000BB]<?
$sql[/COLOR]             [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nederhop` ORDER BY naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$artiest8[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Arties niet gevonden</a>"[/COLOR][COLOR= #007700];
    }
}[/COLOR]
?>


OF

[COLOR= #0000BB]<?
$sql[/COLOR]             [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nederhop` ORDER BY naam ASC"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$artiest8[/COLOR]     [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){
        }
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Arties niet gevonden</a>"[/COLOR][COLOR= #007700];
    }[/COLOR]
?>
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nederhop` ORDER BY naam ASC"[/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/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Geen nederhop artiesten gevonden[/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]$artiest8[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])){[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]naam en dergelijke[/COLOR][COLOR= #007700];
    }
}[/COLOR]
?>
0
Berichten
450
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Die van Luukvdo is goed
zo niet haal een } van onderen weg!
0
Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
@stopkkgroep; dat codes wat je typte doen het niet.

Luuk bij die van jou krijg ik deze melding

Parse error: syntax error, unexpected T_ELSE in /home/faouzi01/domains/imaghreb.nl/public_html/index@h.php on line 331

Quote:
line 330 if(mysql_num_rows($sql) == 0)
line 331 {
line 332 echo Geen nederhop artiesten gevonden;
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Weet je zeker dat je wel de goede versie geüpload hebt?
0
Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
als ik een } weghaal.
doet tie het wel dan zegt tie ook table nederhop_artiest doesnt exit ofso.
Maar dan valt me menu uit elkaarxD
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb je een link?
0
Verkado

Lid · Topicstarter

Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jeps,
KLik

Nou ligt de menu beneden cry
Weet je misschien waarom ?
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