Random URL redirect using PHP and MySQL -


i have question adding link website when 'clicked' send user random url stored in mysql database.

my database titled "movie" , able have user click on link , send them 1 of movie page urls stored in database.

ex: user clicks "random" link , gets taken movie page database(i have 110 urls listed unique id).

would use like:

  • header('location: 'xxxxx);

to accomplish this?

i know should able accomplish task using php, having trouble figuring 1 out. great! thanks.

i'm assuming query posted selects 1 random movie, , field url stored called 'url'.

$result = mysql_query("select url movie order rand() limit 0, 10")                   or die(mysql_error());  $row = mysql_fetch_assoc($result); mysql_free_result($result); header('location: '.$row['url']); 

this should redirect url in database.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -