random iets uit database halen

Gestart doorAdmir0 reacties32 weergaven

1 berichten · pagina 1 van 1

Admir

Lid · Topicstarter

Berichten
1.950
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik ben bezig met scriptje, hij doet het voor 60% ongeveer.
Ik wil dat er steeds personen random uit de database worden gehaalt.

Ik heb ook een vraag, van hoe kan ik het regelen dat per 7 dagen 1 week dus. Een nieuwe persoon uit de database word gehaalt(dus random gewoon)

Dus is me script:

[COLOR= #0000BB]<?php

$spotlight_select[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"
SELECT
    *
FROM
    artiesten
WHERE
    id
ORDER BY
    artiesten,
    RAND()
LIMIT 1
"[/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]$spotlight_select[/COLOR][COLOR= #007700]))
{[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Er zit niemand nog in de spotlights
"[/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]<b><i>Spotlight</i></b>:<br /> [/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$array[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]

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

    [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]] =[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]woonplaats[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]woonplaats[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]woonplaats[/COLOR][COLOR= #007700]] =[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]woonplaats[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]] =[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]]);[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<img src="http://i46.tinypic.com/2gxfo8i.png" border="0"><br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<center>Artiest V/d Week:</center>
<br />
Naam: <center>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</center><br />
Woonplaats:<center> [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]woonplaats[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</center><br />
<center><img src="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]afbeelding[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" width="129" height="85"><br />
<br />
Luister <i>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</i> Tracks in SP player,<br />[/COLOR][COLOR= #007700];[/COLOR]
?>





        <object data="http://www.straat-power.nl/test/42-mp3player.swf?autostart=false&playlist=http://www.straat-power.nl/test/test.php?artiest=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]];[/COLOR] ?>" type="application/x-shockwave-flash" width="300" height="200"><param name="movie" value="http://www.straat-power.nl/test/42-mp3player.swf?autostart=false&playlist=http://www.straat-power.nl/test/test.php?artiest=[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$show[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]artiesten[/COLOR][COLOR= #007700]];[/COLOR] ?>"></object>
        
[COLOR= #0000BB]<?php[/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