1 Bericht laten tonen

Gestart doorRemontjuh34 reacties90 weergaven

35 berichten · pagina 1 van 3

Remontjuh

Lid · Topicstarter

Berichten
1.282
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Eey One2xsers

Ik ben bezig met mijn site alleen ik heb een foutje in me bericht.
Hij showt namelijk alle berichten tegelijk en niet het laatste bericht wat is gepost.
Hoe kan ik dit oplossen?

Script:

[COLOR= #0000BB]<?php[/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]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]#[/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 * FROM `admin_zegt`"[/COLOR][COLOR= #007700]);[/COLOR]



      [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])){[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> zegt:"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"admin_zegt"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];

}[/COLOR]
[COLOR= #FF8000]// gescript voor habbomtv door Mark Huttinga.[/COLOR]
?>


- Remon
0
Berichten
1.533
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/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]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]#[/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 * FROM `admin_zegt` LIMIT 1"[/COLOR][COLOR= #007700]);[/COLOR]



      [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])){[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> zegt:"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"admin_zegt"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];

}[/COLOR]
[COLOR= #FF8000]// gescript voor habbomtv door Mark Huttinga.[/COLOR]
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dan is die while ook niet meer nodig.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
En als je dan evt het laatste bericht wilt tonen voeg je: "ORDER BY kolom_hier DESC" toe.

die kolom_hier staat dan op het veld waarop je wilt orderen, dit kan een primary key (id) zijn, of een datetime.
0
Berichten
8.649
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Raaoul schreef:
En als je dan evt het laatste bericht wilt tonen voeg je: "ORDER BY kolom_hier DESC" toe.

die kolom_hier staat dan op het veld waarop je wilt orderen, dit kan een primary key (id) zijn, of een datetime.
Of zelfs beide redface
0
Remontjuh

Lid · Topicstarter

Berichten
1.282
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Poedeltje schreef:
[COLOR= #0000BB]<?php[/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]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]#[/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 * FROM `admin_zegt` LIMIT 1"[/COLOR][COLOR= #007700]);[/COLOR]



      [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])){[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> zegt:"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"admin_zegt"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];

}[/COLOR]
[COLOR= #FF8000]// gescript voor habbomtv door Mark Huttinga.[/COLOR]
?>
Ik heb hem erin gezet, alleen hij laat het oude bericht staan en niet het nieuwe bericht...
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Er hebben nog meer mensen dan Poedeltje gereageerd.....
En wat is het nut van lege strings aan een variabele koppelen op lijn 12?
Stop je ook serieus lege flessen in de koelkast?
0
Remontjuh

Lid · Topicstarter

Berichten
1.282
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Er hebben nog meer mensen dan Poedeltje gereageerd.....
En wat is het nut van lege strings aan een variabele koppelen op lijn 12?
Stop je ook serieus lege flessen in de koelkast?
Ik heb het script niet gemaakt... Ik ben niet echt php kenner. Iemand anders maakt voor mij alleen ik heb die laatste bericht toon ding nodig xd maar hij is druk.. Dus ik vroeg hier maar aan de one2xs leden.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
En we hebben antwoord gegeven?
0
Remontjuh

Lid · Topicstarter

Berichten
1.282
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
En we hebben antwoord gegeven?
Yep, ik heb dat ding van Raaoul gedaan, alleen krijg ik error....
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Een error, erg duidelijk..... (not)
Kan je wat duidelijker zijn?
0
Remontjuh

Lid · Topicstarter

Berichten
1.282
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/habbomtv/domains/habbomtv.nl/public_html/onderhoudtje/index.php on line 35

[COLOR= #0000BB]<?php

$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"ORDER BY admin_zegt DESC"[/COLOR][COLOR= #007700]);[/COLOR]



      [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])){[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<b>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"gebruikersnaam"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"</b> zegt:"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]"admin_zegt"[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];

}[/COLOR]
[COLOR= #FF8000]// gescript voor habbomtv door Mark Huttinga.[/COLOR]
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Je query klopt van geen kanten. Waar is je select?

Quote:
........ voeg je: "ORDER BY kolom_hier DESC" toe.

Ik lees niks over vervangen!

PHP is wel een leuke taal, maar klakkeloos iets doen omdat de ander wat zegt is niet zo handig. Zorg liever dat je weet WAT je veranderd.
0
Remontjuh

Lid · Topicstarter

Berichten
1.282
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Je query klopt van geen kanten. Waar is je select?
Quote:
........ voeg je: "ORDER BY kolom_hier DESC" toe.

Ik lees niks over vervangen!

PHP is wel een leuke taal, maar klakkeloos iets doen omdat de ander wat zegt is niet zo handig. Zorg liever dat je weet WAT je veranderd.

I Know... Weet wel wat van PHP, meestal wat ik doe gaat goed alleen dit niet...
Ik ken eigelijk ook alleen maar HTML en CSS...
0
Marv

Lid

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
En haal je ww ff weg wink
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