Hello everyone, i'm going to try and explain this to the best of my knowledge. I run an arcade site and I get a bunch of featured request. http://www.GameFrat.com As you can see I have 8 featured games in the featured section (top horizontal). But I want to be able to add more than 8 and the php will pull any 8 from the collection of featured games. I already made a table in my DB called "featured" with 3 fields "Name, Game URL, Thumbnail". I wanna be able to add the info here, display it in html format exactly like I have it now at the top. Can someone right me a mock up please so all I have to do is add Game Name / GameURL.html / Thumbnail.jpg and it will display in a <a href="$game_url"><img src="/images/$thumbnail">$game_name</a> format and it will only display 8 games. Thanks! Doug
hi, i am not really sure on what you want done, is it the form that you want done or the script to pull the random data from the db?
Well I want the data to be pulled and 8 different games being displayed, and upon refresh 8 new games appear. http://www.BootyArcade.com see there top 8 featured games?
well, you can probably use Mysql's random() function ex: SELECT * FROM tableName ORDER BY RAND() LIMIT 8
Well I have that but i'm very new at this and that's all I got <?PHP $rs = mysql_query("SELECT Name AS feat_name, URL AS feat_url, Thumbnail AS feat_thumb from featured ORDER BY RAND() LIMIT 1"); while (list ($feat_name, $feat_url, $feat_thumb) = @mysql_fetch_row($result3)); {"<A href=''>$feat_name</a>"; } ?> PHP:
please try this... <?PHP $rs = mysql_query("SELECT Name AS feat_name, URL AS feat_url, Thumbnail AS feat_thumb from featured ORDER BY RAND() LIMIT 8"); while($row = mysql_fetch_assoc($rs) { echo '<A href="'.$row['feat_url'].'"><img src="'.$row['feat_thumb'].'"></a>"; } ?> Code (markup): it will output the thumbnail with a link, i'm not sure where to put the name though
oh, darn its hard to write code in the editor after </a> just change the double quote " into a single quote '
Thanks for the help serialCODER, I got it now. <?PHP $q=mysql_query("SELECT Name AS feat_name, URL AS feat_url, Thumbnail AS feat_thumb FROM `featured` ORDER BY RAND() ASC LIMIT 8"); while ($line=mysql_fetch_assoc($q)) { echo "<td>"; echo "<a href=\"$line[feat_url]\"><img src=\"$line[feat_thumb]\" />$line[feat_name]</a>"; echo "</td>"; } ?> PHP:
always glad to be of any help if you have projects that would require extensive coding, i am available