Syntax error

Gestart doorJesper52 reacties145 weergaven

53 berichten · pagina 4 van 4

Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Met een while() functie. (Of een for loop.)
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
De fetch in een while stoppen zoals gamedealer inderdaad zegt:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFetcha[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]( ... ) 
{[/COLOR]

[COLOR= #FF8000]// ... echo ...[/COLOR]

[COLOR= #007700]}[/COLOR]
?>
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
De fetch in een while stoppen zoals gamedealer inderdaad zegt:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFetcha[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]( ... )) 
{[/COLOR]

[COLOR= #FF8000]// ... echo ...[/COLOR]

[COLOR= #007700]}[/COLOR]
?>
Wel nog een extra ) in de while
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]connect.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM balk ORDER BY id DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/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]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> : "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" | <br />"[/COLOR][COLOR= #007700];[/COLOR] 


?>

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br /><br /><a href=toevoegen.php>Plaats een bericht</a></div>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//linkje voor een bericht te plaatsen[/COLOR]


?>


Wat is hier fout, want hij geeft geen berichten weer terwijl er 2 berichten in db staan
http://manxi.nl/
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
- Zie http://php.net/while je accolades ( { en } ) ontbreken. Kijk eens naar bovenstaand voorbeeld.
-Foutafhandeling op je $sql. Persoonlijk zou ik de variabele renamen naar $result. Dat is de uiteindelijke uitkomst uiteindelijk.
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]connect.php[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM balk ORDER BY id DESC LIMIT 10"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$res[/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]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> : "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$res[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" | <br />"[/COLOR][COLOR= #007700]; 
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br /><br /><a href=toevoegen.php>Plaats een bericht</a></div>"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//linkje voor een bericht te plaatsen[/COLOR]
?>
0
Jesper

Lid · Topicstarter

Berichten
3.532
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Daarmee blijft de pagina wit confused
toevoeging op 22 januari 2012, 10:41:06:
Laatmaar iemand zat te noscripten confusedhoe beveilig ik hem nu tegen noscript en die onzin
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
htmlspecialchars(); emo
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