该法典完全是自我解释的。 我试图利用 s取随机记录及其价值。 然而,当我上载时,我从来文方的法典来看,所有我都是这样。
<a href="/.php">
<div class="image">
<img src="https://s3.amazonaws.com/images/"
alt=""
/>
</div>
</a>
Here s my code:
<?php
// Get the number of rows in the table
$count = mysql_fetch_assoc(mysql_query( SELECT COUNT(thumbnailID) FROM images ));
// Use those to generate a random number
$count = floatval($count);
$rand = rand(1,$count);
// Select the two columns we need, and use limit to set the boundaries
$query = SELECT link, pic, alt FROM images LIMIT .$rand. ,1 ;
// Run the query
if(($result = mysql_query($query)) !== FALSE) {
// Dump the result into two variables
list($link, $pic, $alt) = mysql_fetch_assoc($result);
// Echo out the result
echo
<a href="/ . $link . .php">
<div class="image">
<img src="https://s3.amazonaws.com/images/ . $pic . "
alt=" . $alt . "
/>
</div>
</a> ;
}
?>
感谢!