Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > PHP

Reply
 
LinkBack Thread Tools Display Modes
Old 10-12-2004, 01:59 PM   #1 (permalink)
jimmyoctane
Registered User
 
jimmyoctane's Avatar
 
Join Date: Sep 2003
Location: California
Posts: 26
jimmyoctane is on a distinguished road
Send a message via AIM to jimmyoctane
Not sure how to phrase this question

I'm not looking for someone to code for me I just need to be pointed in the right direction.

I currently have a table which holds images and information required to display with the images. Because of my limited knowledge in PHP I created one page that sqls the table and grabs the first 6 images and then builds the html to show them on a page. Then I had to do this a "few" more times changing only the Sql to grab records 7 thru 12, then 13 thru 18 ..........

Is there a way to do this in one Php page? Could it generate the navigation passing a parm with the next starting record number and post to itself??????


I hope I was clear in explaining this.

Thanks in advance for the help.

jimmy
jimmyoctane is offline   Reply With Quote
Old 10-12-2004, 02:54 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,706
sde is on a distinguished road
this would make a good tutorial, .. but generally here is how you do it ..

you will need to use a variable for the starting record and use it in the url:
http://site.com/gallery.php?s=1

in your code, you will do something like this:
PHP Code:
<?
// set $s to 1 if there is no value
if(!$_GET['s']){
  
$s 0;
}else{
  
$s $_GET['s'];
}

// get six results starting from s
$result mysql_query("select * from table limit ".$s.",6");

// your link for the next page
echo "<a href=\"".$_SERVER['PHP_SELF']."?s=".($s+6)."\">get next page</a>\n";
?>
i didn't test the code, but it should point you in the right direction.

make sense?

a hell of a lot easier than you would do it in rpg huh?
__________________
Mike
sde is offline   Reply With Quote
Old 10-12-2004, 03:33 PM   #3 (permalink)
jimmyoctane
Registered User
 
jimmyoctane's Avatar
 
Join Date: Sep 2003
Location: California
Posts: 26
jimmyoctane is on a distinguished road
Send a message via AIM to jimmyoctane
Talking maybee 200 lines in RPG

Thanks I'm gonna play around with this.

(your site is busy)
jimmyoctane is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DB Design Question Part II sde Program Design and Methods 10 09-02-2008 11:37 AM
Question marks and apostrophes Belisarius HTML, XML, Javascript, AJAX 4 05-28-2004 04:11 PM
Compiler Question cheawick Standard C, C++ 3 04-30-2004 03:06 AM
another question Ilya020 HTML, XML, Javascript, AJAX 5 08-20-2003 11:54 AM
Nagging question jeffro Lounge 1 03-08-2003 06:46 PM


All times are GMT -8. The time now is 12:35 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting