Script werkt niet

Gestart doorMarv10 reacties61 weergaven

11 berichten · pagina 1 van 1

Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Hallo,

Ik heb een klein scriptje gemaakt, maar ik krijg maar 1 uitvoer, terwijl ik wel limit 10 heb.

Code:

[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SET lc_time_names = NL_nl"[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ReactieQuery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT t_id FROM reacties WHERE poster = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$leden[/COLOR][COLOR= #007700]->[/COLOR]getId[COLOR= #007700]([/COLOR][COLOR= #0000BB]$leden[/COLOR][COLOR= #007700]->[/COLOR]getId[COLOR= #007700]()) .[/COLOR] [COLOR= #DD0000]" LIMIT 10"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]MYSQL error: [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]    
    [COLOR= #0000BB]$ReactieFetch[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]fetch[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ReactieQuery[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$ReactieQuery2[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT DATE_FORMAT(datum, %d %M %Y, om %H:%i) AS datum FROM reacties WHERE t_id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$ReactieFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]t_id[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]" ORDER BY datum DESC"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]MYSQL error: [/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] 
    [COLOR= #0000BB]$ReactieFetch2[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]fetch[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ReactieQuery2[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$TopicQuery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM topics WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$ReactieFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]t_id[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]MYSQL error: [/COLOR] [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]$ReactieQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Je hebt nog geen Reacties geplaatst.[/COLOR][COLOR= #007700];
    }[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    ?>
    <table style="width: 100%">
    <tr>
    [COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$TopicFetch[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]fetch[COLOR= #007700]([/COLOR][COLOR= #0000BB]$TopicQuery[/COLOR][COLOR= #007700])){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]
    <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$TopicFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>
    <td>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$ReactieFetch2[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]datum[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</td>[/COLOR][COLOR= #007700];
        }[/COLOR]
        ?>
    </tr>
</table>
[COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}[/COLOR]
        ?>


Weet iemand waar het aan ligt?

Alvast bedankt.
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je stopt hem niet in een while() ?
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
wat niet?
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$ReactieQuery = $mysql->query("SELECT t_id FROM reacties WHERE poster = " . $leden->getId($leden->getId()) . " LIMIT 10") or die (MYSQL error:  . mysql_error());    
    $ReactieFetch = $mysql->fetch($ReactieQuery);


Die.
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Danku wink
Hoe kan ik er voor zorgen dat hij topics er maar 1 keer uithaald?

Als ik bijv 2x heb gereageerd staat het topic er 2keer tussen.
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zet alleen reacties in een while?
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
en dan werkt het? ik heb het gewoon over dubbele topics omdat daar vaker in gereageerd is door mijzelf....
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jap.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Is het niet een goed idee om je eens in JOINS te verdiepen? Dit kan je zeker een paar queries besparen smile.
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Aarclay schreef:
Is het niet een goed idee om je eens in JOINS te verdiepen? Dit kan je zeker een paar queries besparen smile.
heb ik al een keer gedaan, maar vindt ik heel lastig.. smile
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Marvinguich schreef:
Eerdere citaten tonen
Aarclay schreef:
Is het niet een goed idee om je eens in JOINS te verdiepen? Dit kan je zeker een paar queries besparen smile.
heb ik al een keer gedaan, maar vindt ik heel lastig.. smile
Zo lastig is het niet hoor?
Ik heb de basis in een uurtje geleerd op mijn werk, je moet alleen even een voorbeeld query hebben of een paar, mja ik werk dan wel met MSSQL en niet met MySQL maar is denk ik gewoon het zelfde qua JOINs
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