Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function view_image($photo_id) {
- $sql = "SELECT * FROM screenshots WHERE photo_id = $photo_id";
- $query = mysql_query($sql);
- $result = mysql_fetch_assoc($query);
- echo '<img src="' . $result['image_link'] . '" />';
- echo '<table border="0"><tr><td><i>Image submitted by ' . $result['author'] . ' on ' . $result['date_sub'] . ' at ' . $result['time_sub'] . '</i> </td></tr><tr><td><h3>' . $result['header'] . '</h3></td></tr><tr><td>' . $result['desc'] . '</td></tr><tr><td><em>Voting System Coming Soon!!!!</em></td></tr></table>';
- }
- function image_from_database() {
- // use a running counter for flow control of the outer loop
- $runningcount = 0;
- $r = mysql_query("SELECT * FROM screenshots WHERE photo_id IS NOT NULL AND photo_id !='' ORDER BY photo_id DESC") or die(mysql_error());
- //Get # of images in results to use as upper limit for outer loop
- $img_ct = mysql_num_rows($r);
- while ($runningcount <= $img_ct){
- //rowcount reset to break content blocks
- $rowcount = 0;
- echo "<div class=\"row-fluid\">";
- $runningcount++;
- while(($rowcount <= 3) && $row = mysql_fetch_assoc($r))
- {
- $count = strlen($row['desc']);
- if ($count >= 50) {
- $row['desc'] = substr($row['desc'], 0, 50). "...";
- }
- $rowcount++;
- echo '<div class="span3">';
- echo '<img src="' . $row['image_link'] . '" /> <h4>' . $row['header'] . '</h4><p>' . $row['desc'] . '</p><a href="' . $row['image_link'] . '" rel="lightbox[apgssg]"><button class="btn" type="button">View Details</button></a>';
- echo '</div>';
- }
- echo "</div><br />";
- }
- }
- function image_into_database($image_data) {
- array_walk($image_data, 'array_sanitize');
- $fields = '`' . implode('`, `', array_keys($image_data)) . '`';
- $data = '\'' . implode('\', \'', $image_data) . '\'';
- mysql_query("INSERT INTO screenshots ($fields) VALUES ($data)") or die(mysql_error());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement