Nieuws script

Gestart doorFreestyle6 reacties13 weergaven

7 berichten · pagina 1 van 1

Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik ben bezig met een nieuwsscript
en ik heb jullie hulp weer nodig, want ik kan het nergens vinden.

Uitleg.
Ik wil dat als je op de titel

<a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Nlink[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>


Klikt dat je dan naar: nieuws.php?act=berichttitel gaat.
Maar hoe doe ik dit?

Als je bepaalde code van het script nodig hebt zeg dit dan!

bronnen gezocht:
w3schools.com
phphulp.nl
pfz.nl
sitemasters.be
google
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
sorry dubbelpost, heb al gemeld!
0
Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Euh, eerder had ik ook geen nieuws script in elkaar maar ik weet niet zeker of het goed is..

<a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>


en dan in je nieuws.php pagina (Bovenaan)

[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM `nieuws` WHERE `Ntitel`="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uID[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]


Dit moet lukken.
0
Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
verkado ik bedoel als je op die link drukt

<a href="nieuws.php?act=$berichttitel">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>


dat je dan naar: nieuws.php?act=titelbericht dat je dan het nieuws bericht etc, ziet.

code nieuws.php

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]functions.php[/COLOR][COLOR= #007700]);[/COLOR]
up[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$response[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<TITLE>Host2earn - Nieuws</TITLE>[/COLOR][COLOR= #007700];[/COLOR]
?>

    <table width="600px">
        <tr>
            <td width="33%"><strong>Titel</strong></td>
            <td width="33%"><strong>Auteur</strong></td>
            <td width="33%"><strong>Datum</strong></td>
        </tr>
    </table>
    
[COLOR= #0000BB]<?php
 
$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM nieuws"[/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_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))    

{[/COLOR]
?>
    <table width="600px">
        <tr>
            <td width="33%">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR] ?></td>
            <td width="33%">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Nauteur[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR] ?></td>
            <td width="33%">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ndatum[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR] ?><br /></td>
        </tr>
        <tr>
            <td>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]""[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Nbericht[/COLOR][COLOR= #007700]] .[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR] ?></td>
        </tr>
    </table>
    <hr />
        
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
foot[COLOR= #007700]();[/COLOR]
?>


code waar de links staan:

[COLOR= #0000BB]<?php
$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM nieuws ORDER BY Ndatum DESC LIMIT 5"[/COLOR][COLOR= #007700]);[/COLOR]?>

<h1>Host2earn Nieuws</h1>
    <p style="size:10px;">Host2earn nieuws</p>
    <p>
    [COLOR= #0000BB]<?php[/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_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700])) 
    {[/COLOR]
    ?>
    <a href="[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Nlink[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?></a> [[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ndatum[/COLOR][COLOR= #007700]];[/COLOR] ?>]
    <br />
    [COLOR= #0000BB]<?[/COLOR] [COLOR= #007700]}[/COLOR] ?>
    </p>


Nu wil ik als je op de link drukt dat je naar de pagina nieuws.php gaat en dat je alleen het bericht van de link ziet.

ik heb btw, niks wat de Nlink aanmaakt ofzo (had het als voorbeeld)
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
<a href="nieuws.php?act=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Nlink[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>


[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]act[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Nlink[/COLOR][COLOR= #007700]])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]nieuwsbericht[/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]nieuwsbericht niet gevonden[/COLOR][COLOR= #007700];
}[/COLOR]
?>


zoiets denk ik?
0
Berichten
529
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Probeer wat marjolein heeft gepost anders
verander je in nieuws.php
dit:

[COLOR= #0000BB]<?php
 
$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM nieuws WHERE Ntitel"[/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_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))    

{[/COLOR]
?>


En dit @ links..

<a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?>">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Ntitel[/COLOR][COLOR= #007700]];[/COLOR] ?></a>


Je bedoelt dat je bijv dit ziet. ?p=Nieuws&naam=Nieuwstitel

NIeuwsTittel in de link wil je dus.
Anders weet ik het echt niet sadley
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]act[/COLOR][COLOR= #007700]]) &&[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]act[/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
                            id,
                            titel
                        FROM
                            nieuws
                        WHERE
                            titel = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]act[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][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]$Query[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Query[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/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]Dit nieuwsbericht bestaat niet.[/COLOR][COLOR= #007700];
    }
                            
}[/COLOR]
?>
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