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
Post a Comment