 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
04-09-2009, 03:14 AM
|
#21 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Location: Springfield, IL USA
Posts: 75
Thanks: 3
|
Hey ... I am soooo happy you were able to get it sorted! That's just super
Yep, I'm a tad busy tonight. But I'm making good progress. I just wish I had more hands, more fingers, and better eyesight. LOL.
|
|
|
|
04-09-2009, 03:18 AM
|
#22 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by WebSavvy
Hey ... I am soooo happy you were able to get it sorted! That's just super
Yep, I'm a tad busy tonight. But I'm making good progress. I just wish I had more hands, more fingers, and better eyesight. LOL.
|
I hear ya....but you're "savvy", I know you'll get things done.
I won't bother you anymore tonite then, I'm heading out anyways as soon as i finish checking out my apache logs...
Have a good one and thanks again!
|
|
|
|
04-09-2009, 03:23 AM
|
#23 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Location: Springfield, IL USA
Posts: 75
Thanks: 3
|
Ah, you were no bother. I don't mind helping people, ever. Have a good time. I'll be ready to call it a night shortly. Then it'll be return to the slog in the morning. 
|
|
|
|
04-09-2009, 09:12 AM
|
#24 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Just a question; Why would you want a pagination script that is limited to MySQL results? Or even limited to database? Sometimes you want to paginate other things than results from a database.
Try to make it paginate data independent if it's result from a database, images from a folder, or just simply; An array of data.
__________________
|
|
|
|
04-09-2009, 02:13 PM
|
#25 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by Tanax
Just a question; Why would you want a pagination script that is limited to MySQL results? Or even limited to database? Sometimes you want to paginate other things than results from a database.
Try to make it paginate data independent if it's result from a database, images from a folder, or just simply; An array of data.
|
Well, when we start to turn this into a class, I was thinking of having the SQL results be separate, so in theory you would be able to feed it anything I suppose. I guess it should be DB independant, but I personally haven't ran into any situations where I need pagination that doesn't deal with mySQL, so the thought never really occurred to me...
|
|
|
|
04-09-2009, 03:38 PM
|
#26 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by allworknoplay
Well, when we start to turn this into a class, I was thinking of having the SQL results be separate, so in theory you would be able to feed it anything I suppose. I guess it should be DB independant, but I personally haven't ran into any situations where I need pagination that doesn't deal with mySQL, so the thought never really occurred to me...
|
I personally haven't used everything I know of PHP, that doesn't mean that it's a waste to learn it
Check this, might give you some inspiration
Pagination class
__________________
|
|
|
|
04-09-2009, 03:45 PM
|
#27 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by Tanax
I personally haven't used everything I know of PHP, that doesn't mean that it's a waste to learn it
Check this, might give you some inspiration
Pagination class
|
Thanks I will check it out. I found a quick typo in your post.
You said, "Also, this *should* work without MySQL, eventhough my example is based on MySQL"
So one of them I assume should be MS SQL...

|
|
|
|
04-09-2009, 03:58 PM
|
#28 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by allworknoplay
Thanks I will check it out. I found a quick typo in your post.
You said, "Also, this *should* work without MySQL, eventhough my example is based on MySQL"
So one of them I assume should be MS SQL...

|
I didn't understand that xD
My example is based on MySQL and not MS SQL, but you can use the pagination class for MS SQL, MySQLi, Oracle, images in a folder(whihch salathe posted an example of as a reply post), etc. Just about any array of data it will paginate
But probably I misunderstood what you meant with your post xD
__________________
|
|
|
|
04-09-2009, 08:19 PM
|
#29 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Location: Springfield, IL USA
Posts: 75
Thanks: 3
|
Quote:
Originally Posted by Tanax
Just a question; Why would you want a pagination script that is limited to MySQL results? Or even limited to database? Sometimes you want to paginate other things than results from a database.
|
By the same token, why would I want a pagination script that's doing more things than what I need?
I don't use anything other than MySQL and the only things I require to be paginated are results from a database. My usage is in my directory script and it works perfectly fine for me. I have no desire to change what isn't broken.
However, I can see examples of some instances where someone would require pagination that isn't database dependent. So, it basically comes down to this: People will use what fits their needs and suits their purposes. 
|
|
|
|
04-09-2009, 08:33 PM
|
#30 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by Tanax
I didn't understand that xD
My example is based on MySQL and not MS SQL, but you can use the pagination class for MS SQL, MySQLi, Oracle, images in a folder(whihch salathe posted an example of as a reply post), etc. Just about any array of data it will paginate
But probably I misunderstood what you meant with your post xD
|
It's the way I read what you wrote. After reading it I can see what you mean, but I will explain what I thought you meant anyways since I like to talk a lot...
When you said, "this should work in mySQL, eventhough your example is based on mySQL"
When you read it fast it looks like you meant to say that one of them is MS SQL like this:
"this should work in mySQL, eventhough my example is based on MS SQL"...
The way it's worded, sounds like it's designed to work with one DB and SHOULD work in another DB, eventhough it was designed with a different DB...see what I mean?
|
|
|
|
04-09-2009, 08:36 PM
|
#31 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
|
Hmm your code is sort of weird in the manner that you say:
<?php print_r("$variable"); ?>
and later you use:
<?= $variable; ?>
Also, why use string interpolation when you don't concate the data with something else? Seems pretty pointless to waste time on something so simple.
ps. I see you use notation on the $strSQL = mysql_query(...);, well technically that is a resource returned and not a string, but heeeey :)
__________________
|
|
|
04-09-2009, 08:43 PM
|
#32 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Location: Springfield, IL USA
Posts: 75
Thanks: 3
|
Quote:
Hmm your code is sort of weird in the manner that you say:
<?php print_r("$variable"); ?>
and later you use:
<?= $variable; ?>
|
I use print_r("$variable") when I'm coding. The <?=$variable;?> was added just as an example for something to place there for allworknoplay to get an idea. I did this quickly yesterday as I was busy with other work, which I mentioned already.
Quote:
Also, why use string interpolation when you don't concate the data with something else? Seems pretty pointless to waste time on something so simple.
ps. I see you use notation on the $strSQL = mysql_query(...);, well technically that is a resource returned and not a string, but heeeey :)
|
I code things in a way that's easy for the screen reader to read it back to me so I can understand it. If you've ever used a screen reader in your life you'd know where I'm coming from with that regard.
|
|
|
|
04-10-2009, 09:44 AM
|
#33 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by WebSavvy
By the same token, why would I want a pagination script that's doing more things than what I need?
I don't use anything other than MySQL and the only things I require to be paginated are results from a database. My usage is in my directory script and it works perfectly fine for me. I have no desire to change what isn't broken.
However, I can see examples of some instances where someone would require pagination that isn't database dependent. So, it basically comes down to this: People will use what fits their needs and suits their purposes. 
|
It's not doing more things than what you need. It's doing exactlyy what you need. It just CAN do other things aswell.
I don't use anything other than MySQL aswell, which is why my example usage of the pagination class was based on MySQL - heck, I didn't even know how to use the class without MySQL. But my point still stands. Why use something that is limited to one thing, instead of using a more "allround" solution. It will work with your database. It will work later when you do use results from another source, for example an image folder on your host.
It's like.. buying a stereo, and there are 2 types of stereos, one that supports only CD, and then another that supports CD and DVD. They're the same price. You only use CD, so you buy the one that only supports CD, but then later, you wanna use DVD cause everything moves over from CD to DVD, then you'd need to buy another one. In this case you would need to recode your whole script just so it can support pagination for data other than results from a database.
Quote:
Originally Posted by allworknoplay
It's the way I read what you wrote. After reading it I can see what you mean, but I will explain what I thought you meant anyways since I like to talk a lot...
When you said, "this should work in mySQL, eventhough your example is based on mySQL"
When you read it fast it looks like you meant to say that one of them is MS SQL like this:
"this should work in mySQL, eventhough my example is based on MS SQL"...
The way it's worded, sounds like it's designed to work with one DB and SHOULD work in another DB, eventhough it was designed with a different DB...see what I mean?
|
OOoh, I see. No no, I meant exactly what I wrote: This should work without MySQL(with any array of data), even if I used MySQL in my example xD ^_^
__________________
|
|
|
|
|
The Following User Says Thank You to Tanax For This Useful Post:
|
|
04-10-2009, 11:37 AM
|
#34 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Quote:
Originally Posted by Tanax
OOoh, I see. No no, I meant exactly what I wrote: This should work without MySQL(with any array of data), even if I used MySQL in my example xD ^_^
|
I was just reviewing your code, is this just a quick form for the if conditional?
(isset($p)) ? $p : 1;
Basically it's just saying, if $p is set, then take that value of $p, if it's not set, then set it to 1.
I had no idea you can do an "if" conditional without the actual call to an "if"...
|
|
|
|
04-10-2009, 11:57 AM
|
#35 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Yes, that's an if condition, btw, post in that thread if you have any more questions about that code since it's quite offtopic here.
And that class is quite old, it's not the best. But it definitely get the job done(I've recoded it on localhost so I got a better version though).
Every day we learn something new 
__________________
|
|
|
|
04-11-2009, 12:27 AM
|
#36 (permalink)
|
|
The Contributor
Join Date: Mar 2009
Location: Springfield, IL USA
Posts: 75
Thanks: 3
|
Quote:
Originally Posted by Tanax
It's not doing more things than what you need. It's doing exactlyy what you need. It just CAN do other things aswell.
I don't use anything other than MySQL aswell, which is why my example usage of the pagination class was based on MySQL - heck, I didn't even know how to use the class without MySQL. But my point still stands. Why use something that is limited to one thing, instead of using a more "allround" solution. It will work with your database. It will work later when you do use results from another source, for example an image folder on your host.
It's like.. buying a stereo, and there are 2 types of stereos, one that supports only CD, and then another that supports CD and DVD. They're the same price. You only use CD, so you buy the one that only supports CD, but then later, you wanna use DVD cause everything moves over from CD to DVD, then you'd need to buy another one. In this case you would need to recode your whole script just so it can support pagination for data other than results from a database.
|
Ahhh, I now see what you mean. Thank you for taking the time to explain things more clearly.
The code that I've written above is very old. In fact, I was very new to php at the time when I coded it -- only about 2 months into it.
I just have never gone back to recode it to where it's more up to date. I probably should take the time to do it though, but it'll have to wait until I'm finished with the 11,000 url entries I'm working on in my db at the moment.
I'll look into using your class as an example sometime next week perhaps. If I run into anything I'm not sure about I'll ask in that thread.
|
|
|
|
06-06-2009, 11:54 AM
|
#37 (permalink)
|
|
The Visitor
Join Date: Jun 2009
Posts: 2
Thanks: 0
|
Hi is anyone helpe me wait this sql table
CREATE TABLE video (
id tinyint(4) NOT NULL auto_increment,
singer_name text NOT NULL,
category text NOT NULL,
song_name text NOT NULL,
video_url text NOT NULL,
img_url text NOT NULL,
dis text NOT NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
the result code is
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<div align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%"> </td>
<td width="99%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td height="395" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11%"><?php
include ("config.php");
mysql_connect($db_host,$db_user,$db_pass) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
$result = mysql_query("SELECT * FROM video order by id desc LIMIT 3");
while($r=mysql_fetch_array($result))
{
$singer_name=$r["singer_name"];
$song_name=$r["song_name"];
$dis=$r["dis"];
$id=$r["id"];
$img_url=$r["img"];
?></td>
<td width="89%"> </td>
</tr>
<tr>
<td height="96" align="center" valign="top"><? echo "<img border='0' src="; if ($img_url=="") { echo 'images/nopic.gif'; } else { echo "$img"; } echo" width='80' height='70'>"; ?></td>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="26" valign="middle"><?=$Singer_name?></td>
</tr>
<tr>
<td height="21"><?=$song_name_name?></td>
</tr>
<tr>
<td height="21"><?=$dis?></td>
</tr>
<tr>
<td height="21"><a href="viewvideo.php?id=<?=$id?>">Click Here To Watch
<?=$video?>
Video </a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="14" align="left" valign="top"> </td>
<td> </td>
</tr>
</table>
<? } ?>
<?php mysql_close(); ?></td>
</tr>
</table></td>
</tr>
</table>
</div>
</body>
</html>
but it show only limit
how does it work wait pagination 10 row per page ?
Last edited by lema : 06-06-2009 at 06:10 PM.
|
|
|
|
06-06-2009, 02:04 PM
|
#38 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Welcome Lema! Why did you bury your post in a random thread?  Don't be afraid to create a new thread!
Do you want pagination then for this? As in, page 1, page 2, page 3, etcetera.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
06-06-2009, 06:14 PM
|
#39 (permalink)
|
|
The Visitor
Join Date: Jun 2009
Posts: 2
Thanks: 0
|
Thanx Wildhoney
can you please helpe me how to use pagination in complate code resuld from my sql table thanx .
|
|
|
|
12-22-2011, 09:48 AM
|
#40 (permalink)
|
|
The Visitor
Join Date: Dec 2011
Posts: 2
Thanks: 0
|
thanks
hey script very simple nice thanq dude
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|