Feeds:
Posts
Comments

Assalamu’alaikum

New version of Ry’s paging Class which is ver 0.6 now release.

This version is now support SQLserver database…. how to use Ry’s Paging Class see ry’s paging class ver0.5 for php & mysql

But here, when you call generate variable function you need to give more attribute
$pagination=new pagination;
$var=$pagination->generatevariable(item per page,“your sql string”,“database type”);

For the database type you can choose whether to use sql or mysql

Of course you also need to know how paging work for sql server here the sql syntax example for implementing limit on sql server
$myprojectString=”select top “.$limitperpage.” ID from tablename where ID not in(select top “.$var[0].” ID from tablename)”;

–> $var[0] is generated by function generatevariable() the rest is just the same with how to use Ry’s Paging Class ver0.5

For the class you can download here

If you find any error or new modification please report to me. Hopefully we can develop some future work together

Enjoy!!!

Wassalamu’alaikum

Assalamu’alaikum

weew it was a long time since my last post….

Now we meet again, here I would like to promote one of my php class which is used for pagination….called ry’s PHP pagination v0.5

This class was created during the development of www.kantongmusik.com, you can said that it was accidentally created.

This is a open source code so if you find any bugs or error you free to fix it and please give a report to me or give me your fixed code (this is an agreement) :p.

For this immature version, this class only compatible with windows/linux OS, >PHP4, and MySQL database (soon will be compatible for SQLServer).

You can download the script here
http://www.geocities.com/urhcaf_xp/rypaging_class.zip

Features inside:
- This class give instant pagination navigation
- 2 navigation style google like, book like
- Easy to use
- Opensource
- Free

How to use

First of all you need to make sure that you connected to your database server. Since this class empower session as its core, you need to add session_start() in the beginning of your code

<?php
//required (fardu a’in)
session_start();
$conn=mysql_connect("host","username","password");
$select_db=mysql_select_db("newsportal",$conn);
include("rypaging_class.php"); // embed pagination class (consider the path)
?>
<table cellpadding="5">
<tr style="font-weight:bold;background-color:#CCCCCC;" align="center">
<td>Id</td>
<td>News Title</td>
</tr>
<?php
// define $pagination as class pagination
$pagination=new pagination;

// call variable needed for the pagination
// $var will be an array with $var[0] as item perpage, $var[1] as current page, and $var[2] as total page

$var=$pagination->generatevariable(5,"select news_id from news");

// here are your SQL syntax string to get the data from database
$myprojectString="select news_id,news_title from news limit ".$var[0].",5";
$myprojectQuery=mysql_query($myprojectString);
$no=1;
while ($myprojectFetch=mysql_fetch_array($myprojectQuery)){
echo "
<tr>
<td>",$myprojectFetch['content_id'],"</td>
<td>",$myprojectFetch['content_title'],"</td>
</tr>
";
$no++;
}
?>
<tr>
<td align="center" colspan="2">
<!-- START PAGINATION -->
<?php
// render the pagination
$pagination->rendernavbook($var[1],$var[2]);
?>
<!-- END PAGINATION -->
</td>
</tr>
</table>

here you can render two navigation style
- google like: you can use $pagination->rendernavgo($var[1],$var[2]); at render the pagination section
- book like: you can use $pagination->rendernavbook($var[1],$var[2]); at render the pagination section

Enjoy…!!!!

Wassalam

Sometimes I feel lonely
Even in a crowded place
I hate become gloomy
Even I can’t put that away from my face

I pretend to be strong
And I hope that I can become really strong
Even it will take too long
I just need to think that I wasn’t wrong

Sometimes I really confuse
That my heart wrongly diffuse
Which will make me lose
On the way that i choose

If only I could cry
I’m sure I’ll make a try
Not because I’m too shy
It just because my heart is dry

PostgreSQL n PHP

A$ wr wb

Beuh someone said “it will be better if your blog is written in English”….but if i forced my blog to be written in English….oh god I was realize that my English not really good….plus, I dunno how to express some terrible word like I usually did on my previous post….

but anyway on the other point, i think it will be great for me to improve my English writing experience….especially to express something in English as I want…..he he
so for anyone who use English as ur native language and advance in English….pardon me okay…..

Enough with the prologue…now we just jump to our main topic….my “sok teknikal” post. In this opportunity, i would like to share about the integration of PHP (my fave) with PostgreSQL for their database….Again this post is pointed for the newbie (just like me)….so if u are master on those two things (PHP + PostgreSQL) u allow to read this and give a comment is a must..

Installing PostgreSQL
————————————–
Before u install postgre, u need to do some prerequisite activity….
1. Wash your hand
2. Pray
3. Download PostgreSQL installer here http://www.postgresql.org/download/

In this case, just click on the installer launcher and follow the instruction. The default port for PostgreSQL will be 5432 (just keep it like that, as you see it was a beautiful port number he he)

Preparing integration with PHP
———————————————-
Before work with PHP first you must check whether php_pgsql.dll is already installed or not. You can check it on your “php/extensions/” folder. After you sure that those extension already installed, next you need to activate it on PHP.ini. to activate you can add this line on your PHP.ini “extension=php_pgsql.dll” or when it already exist, you can just open the comment tag in front of those line.

ok now you ready to operate PostgreSQL using PHP…..

Database Connection to PestgreSQL
—————————————————-
Now open your PHP editor…and start creating new project….called myfirstphppostgre.php (if you think the file name is too long you can change it – it’s really recommended to because i feel the same he he)

+ Connect to PostgreSQL
ok now we begin to connect our PHP with PostgreSQL. As you know to connect in to some database we need this variable:
$dbhost = host where your database is stored
$dbuser = user of your database server
$dbpassword = password of your database server (if possible you need to encrypt this)

PostgreSQL connection string is little bit different from SQLServer or MySQL. here the function to connect into PostGreSQL
posgres1.jpg

Then test your connection
posgres21.jpg

+ PostgreSQL Syntax
As default Setting, SQL syntax on PostgreSQL need quotes character (”") to recognize table name and field name (just like oracle i think -> CMIIMW). Here is the example of select syntax on postgreSQL and executed by PHP.
posgres3.jpg

Those are simple and standart examples of executing SQL syntax on PostgreSQL using PHP. Those rules also implemented for another postgreSQL syntax. And here some default SQL execution syntax functions on PHP for postgreSQL that often used:

- pg_query($SQLString)
- pg_num_rows($SQLQuery)
- pg_fetch_array($SQLQuery)

- etc (read on pnp manual for more he he…http://www.php.net)

Here is the example of showing a data on html table:
posgres4.jpg

Ok I think that’s it, all the first step you need to know to make you able to work with PHP and PostGreSQL. You can improvise your PHP and PostgreSQL integration to get more advance experience.

(OOT: you know dude, for me, an outstanding effort was needed to write all of this in English…..thank God it finally done) for someone that give me an advice to write in English…u can consider it done…..he he he

W$ wr wb

Image Security

Assalamu’alaikum

Kemaren temen ane tiba2 nge BUZZ di YM…..dan langsung nonjok ane dengan pertanyaannya “wah gw pake security image di joomla mesti ngaktivin blablabla.dll di server…tapi orang di hostingan ga mau nginstallin tuh dll file….gmn nih ada solusi ga…..”

Waktu itu ane banyak kerjaan jadi spontan ane jawab “ada..” (perasaan ga nyambung). si temen menimpali “gmn caranya….?” dan ane menjawab ringan “cari di internet ato bikin sendiri” (he he he)

terus dia (red:temen ane) bilang “wah ga ada waktu gw…”. yah ane mikir daripada ngabisin waktu mikir gmn nginstall dll file di server mending mikir gmn nyari di internet ato bikin “hhhffffff”. Emang sih waktu itu ane ga ngasih solusi berupa fakta (algoritma, coding, ato laennya) karena ya itu tadi ane sibuk bos…3 project deadline senen semua….walah.

eh pas tadi pagi berangkat ke kantor biasa ane langsung buka e-mail, Ym, browsing2. Nah pas browsing ane nemu dari sitenya bang hatma tentang image security yang sesuai sama pertanyaan temen ane kemaren. kira 2 codenya kayak gini:

imgsecure_hatma.jpg

Wah baru tau ane cara bikin image security kayak gitu….terus ane improvisasi dikit pake2 sotosop jadi gambar bisa lebih variatif so klo yang ini kodingan ane sendiri.

imagesecure_me

hasilnya kurang lebih kayak gini….

imagesecure_me_hasil

Buat temen ane…..bikin yang standar2 aja kayak gitu ga makan waktu lama kok paling2 1/2 jam an…so di coba2 aja….btw buat image klo ente pake script punya ane bikin aja image yang judulnya 0-9 dengan ekstensi .jpg.. ato script itu juga masih bisa di improvise…so sok dicoba-coba….gratis

” I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world “
Author: Albert Einstein

Wassalam

Older Posts »