Jump to content

Search the Community

Showing results for tags 'next'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 2 results

  1. I have the following code allowing me to navigate to the previous or next record in the db. In the code below, I would like to swap 'new_date' (which is in the 000-00-00) format for the existing 'record_id' in the script. I need to navigate via the new_date because it is possible with my program to delete a record and reenter it later for that passed date causing the record_id to be out of sinc with the reord_id. Example: My record_id is auto-increment so if I find a mistake in a past record and go to fix it for that date in the past, my auto-increment would be 235, 236, 237, 568, 239, 240 etc., so I can't use record_id to navigate next and previous. When I use new_date instead of record_id, my error says either that the query was empty, or that Variable id not defined. Script terminating. I would appreciate any help you can give, Thanks! Doug This is also on a web page, so here's my code: php: $current_id = $_GET['record_id']; $record_id = $current_id; $prevquery = "SELECT * FROM daily_sales WHERE record_id < $current_id ORDER BY record_id DESC LIMIT 1"; echo $current_id; $prevresult = mysql_query($prevquery) or die(mysql_error()); while($prevrow = mysql_fetch_array($prevresult)) { $previd = $prevrow['record_id']; } $nextquery = "SELECT * FROM daily_sales WHERE record_id > $current_id ORDER BY record_id ASC LIMIT 1"; $nextresult = mysql_query($nextquery) or die(mysql_error()); while($nextrow = mysql_fetch_array($nextresult)) { $nextid = $nextrow['record_id']; } html: <a href="http://www.mywebsite.com/view.php?record_id=<?php echo $previd; ?>">Previous</a> <a href="http://www.mywebsite.com/view.php?record_id=<?php echo $nextid; ?>">next</a>
  2. Dear All this is my first topic here i need some help with php coding, I have an old script for image gallery that i were able to upgrade on it. I did some change by adding the option of the categories but my issue is when going to the second page ( each page has X amount of images ) and the page splitte to ?page= 2 and like that. but when i add the category id this option didn't work please help. <?php // Get Page config Info $info = @mysql_query("SELECT keywords,description,sitetitle FROM configtable LIMIT 1"); $pageInfo = @mysql_fetch_assoc($info); $pageDesc = $pageInfo['description']; $pageKeyw = $pageInfo['keywords']; $general_title = $pageInfo['sitetitle']; $rowSen = 21; $numRow = $rowSen + 1; //check the page number if(empty($page) || !is_numeric($page)){ $st = 0; $page = 0; }else if(is_numeric($page)){ $st = $page * ($numRow+1); $st = @mysql_real_escape_string($st); } // Get Photos By Category if(isset($_GET['id'])){ $id = @mysql_real_escape_string($_GET['id']); $get_all_images = mysql_query("SELECT * FROM photos WHERE photo_country = $id"); $num_images = mysql_num_rows($get_all_images); $QueryCount = @mysql_query("SELECT count(*) as num FROM photos WHERE photo_country = $id"); $QueryNumbr = @mysql_fetch_assoc($QueryCount); // Get Country By Id $countries_set = @mysql_query("SELECT * FROM countries WHERE id = $id LIMIT 1"); $country = mysql_fetch_assoc($countries_set) ; $countrysnum = @mysql_num_rows($countries_set); } else { $photos_set = @mysql_query("SELECT * FROM countries ORDER BY id desc"); } ?> and herer is my gallery <table width="850px" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td><?php if($num_images>0){ $count = 0; $num = 0; $fin = 0; $num_colm = 3; while($row = mysql_fetch_assoc($get_all_images)){ if($count < $rowSen){ $fin++; if($num==$num_colm){ echo "</tr>\n"; echo "<tr>\n"; $num = 0; }else if($num==0){ echo "<tr>\n"; } if($lan=='en'){ $download = "Download"; }else{ $download = "Download"; } $PICnewPath = 'data/photos/'.$row['photo_name'] ; echo '<td><center><a href="'.$PICnewPath.'" rel="lightbox[roadtrip]"><img style="font-size:15px;" onmouseover="this.style.opacity = \'0.4\';" onmouseout="this.style.opacity = \'1\';" height="150" src="'.$PICnewPath.'" alt="'.$row['photo_title'].'" title="'.$row['photo_title'].' " /></a></center><p><center>' . $row['photo_title'] . '<br /> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <td> ' . substr(stripslashes(strip_tags($row['photo_dec'])),0,500) . '<a href="picture.php?&id=' . $row['photo_id'] . '"> Read More</a></td> </tr> </table> </center></p> </div></td>'; $num++; if($fin == $num_images){ if($num!=$num_colm && $fin>$num_colm){ $subtract = $num_colm - $num; for($i=0;$i<$subtract;$i++){ echo '<td> </td>'; } } echo "</tr>\n"; } } $count++; } }else{ $brak = '<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />'; if($lan=='en'){ echo '<tr><td>There is no images right now'.$brak.'</td></tr>'; }else{ echo '<tr><td>There is no images right now'.$brak.'</td></tr>'; } } ?></td> </tr> </table> and here is my page splitting code <?php $dataNum = $QueryNumbr['num']; if($dataNum>$numRow){ $numPages = $dataNum/$rowSen; $numPages = ceil($numPages); for($i=0;$i<$numPages;$i++){ $pageNum = $i + 1; if($i==$page){ echo '<b><span class="shift" style="font-size:15px">'.$pageNum.'</span> '; }else{ echo '<a style="font-size:15px" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&page='.$i.'" class="shift">'.$pageNum.'</a></b> '; } } } ?> Please help
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.