phpShared cara mengkoneksikan database dalam bentuk *.dbf dengan menggunakan php. Kalau biasanya anda menggunakan dalm bentuk sql, bagaimana jika menggunakan database foxpro (dbf).

Ada beberapa penjelasan mengenai dbase Function yang dapat anda baca di http://www.php.net/manual/en/ref.dbase.php

Nah dari artikel tersebut, dapat saya beri contoh secara sederhana sebagai berikut:

1. Koneksi PHP ke DBF

Jika kita menggunakan MySQL, kita lebih mengenalnya sebagai mysql_connect(“host”,”user”,”pass”); Maka di dalam menggunakan DBF File database syntaksnya adalah dbase_open(“lokasifile”,identifier);
Sebagai Contoh :  database(dbf) bernama siswa.dbf dan lokasinya berada di dalam folder \db, maka penulisannya adalah :

$foxpro=dbase_open(“DB/siswa.dbf”,2);

Ada sedikit penjelasan mengenai identifier, yaitu : 0 = read only, 1 = write only, 2 = read/write

2. Mengetahui Jumlah record file

Untuk mengecek jumlah record jika menggunakan MySql adalah mysql_num_rows($query); maka di dalam database dbf, maka dapat menggunakan perintah

$jumlah=dbase_numrecords($db);

3. Menyimpan Array Record ke Variable

Jika menggunakan MySQL lebih di kenal dengan perintah mysql_fetch_array maka di DBF File menggunakan perintah

dbase_get_record_with_names($db,$urutan);

Sebagai Contoh :

$db=dbase_open(“db/siswa.dbf”,2);
$jum=dbase_numrecords($db);

for($i=1;$i=$jum;$i++){        //lakukan perulangan berdasarkan jumlah data
$hasil=dbase_get_record_with_names($db,$i);    /*simpan record di array $hasil*/
}

4. Menampilkan record tertentu

Jika menggunakan MySQL perintah syntax nya adalah misalkan => mysql_query(“select * from guru where kode=’100’ “); maka menggunakan DBF adalah :

$db=dbase_open(“db/siswa.dbf”,2);
$jum=dbase_numrecords($db);

for($ix=1;$xi,=$jum;$xi++){
     $hasil=dbase_get_record_with_names($db,$i);
          if($hasil[‘kode’]==”100”){           //masukkan kriteria
             echo “Data di temukan pada record ke $i”;      /*output */
             break;       /*stop perulangan jika syarat terpenuhi */

         }
}

5. Delete record

Jika MySQL syntax mysql_query(“delete from siswa where nip=’212′”); maka di dalam dbf adalah

$db=dbase_open(“db/siswa.dbf”,2);

$hapus=dbase_delete_record($db,2);  /* di mysql berdasarkan field-nya tapi jika di DBF berdasarkan nomor urut record */

dbase_pack($db); /*database dipack agar data terhapus tidak hanya terindek dengan deleted saja (agar benar2 terhapus)*/

dbase_close($db);

6. Update Record

Untuk melakukan update data prinsipnya nomor record yang hendak diupdate musti disebutkan, dan isi update an itu juga disebutkan :

$db=dbase_open(“db/siswa.dbf”,2);

$val=array(“data1″,”data2″);  /*berisikan field di dalam record, misalkan jika field berjumlah 4 maka jumlah array juga  ada 4 */

$update=dbase_update_record($db,$val,$urutan); /*update di no ke $urutan dengan isi record $val itu sendiri*/

7. Add / Tambah record

Jika ingin menambah data prinspnya sama seperti update tapi tidak diberi nomor urut data sehingga seperti ini :

$db=dbase_open(“db/siswa.dbf”,2);

$val=array(“data1″,”data2″); /*berisikan field di dalam record, misalkan jika field berjumlah 4 maka jumlah array juga  ada 4 */

$update=dbase_add_record($db,$val);  /*masukkan datanya  */

Pastikan di dalam server anda sudah terdapat php_dbase.dll terlebih dahulu. Jika belum maka dapat mengunduh  di sini php_dbase.dll

Setelah itu masukkan ke dalam php extention server anda. Misal jika menggunakan XAMPP maka copykan file php_dbase.dll ke dalam directory xampp\php\ext

Nah, semoga penjelasan di atas dapat membantu.. Selamat Mencoba

Koneksi PHP with DBF Database

You May Also Like

31 thoughts on “Koneksi PHP with DBF Database

  1. Yet another issue is that video gaming became one of the all-time biggest forms of fun for people of any age. Kids play video games, and also adults do, too. The XBox 360 is among the favorite gaming systems for individuals that love to have hundreds of activities available to them, along with who like to experiment with live with some others all over the world. Thank you for sharing your notions.

  2. A further issue is that video games are normally serious naturally with the principal focus on understanding rather than entertainment. Although, it comes with an entertainment feature to keep your young ones engaged, each game is normally designed to work with a specific experience or curriculum, such as math concepts or scientific research. Thanks for your post.

  3. Thank you so much for providing individuals with remarkably spectacular possiblity to read critical reviews from this web site. It is always so ideal and also packed with a lot of fun for me personally and my office acquaintances to search your web site at least thrice a week to read the newest secrets you have got. And lastly, I’m certainly astounded with your sensational inspiring ideas served by you. Certain 3 tips on this page are really the simplest we’ve had.

  4. I not to mention my friends happened to be reading the great guides found on the website while suddenly came up with a horrible suspicion I had not thanked you for them. Most of the boys are already for this reason warmed to learn all of them and now have definitely been having fun with them. Appreciate your genuinely very accommodating and also for deciding upon such quality subject areas millions of individuals are really wanting to discover. Our honest apologies for not expressing appreciation to you sooner.

  5. I just wanted to develop a quick remark to thank you for the fabulous secrets you are placing at this site. My particularly long internet investigation has finally been honored with professional insight to talk about with my good friends. I ‘d point out that we readers are undoubtedly blessed to dwell in a great site with very many perfect individuals with beneficial hints. I feel truly privileged to have come across your entire website and look forward to many more excellent minutes reading here. Thanks once more for everything.

  6. Thank you so much for giving everyone an extraordinarily spectacular chance to read from this web site. It really is so fantastic and full of fun for me and my office colleagues to search the blog at the least 3 times a week to study the latest items you have. And indeed, I am just usually satisfied with your mind-boggling secrets you give. Some 3 points on this page are completely the finest we have all had.

  7. I and also my pals were following the great guidelines from your website and then instantly developed a horrible suspicion I had not thanked you for them. The people ended up totally thrilled to read through them and have now clearly been taking advantage of them. Appreciation for genuinely considerably accommodating and then for deciding upon these kinds of important tips most people are really eager to know about. Our own honest apologies for not saying thanks to earlier.

  8. I wish to express some thanks to you just for bailing me out of this particular crisis. Right after researching through the world-wide-web and obtaining opinions that were not beneficial, I believed my life was over. Being alive minus the answers to the problems you’ve fixed through this short post is a crucial case, as well as those that could have adversely damaged my entire career if I had not noticed the blog. The skills and kindness in taking care of every aspect was very helpful. I’m not sure what I would have done if I had not encountered such a solution like this. I can also at this moment relish my future. Thank you so much for the professional and results-oriented help. I will not think twice to endorse your web page to any individual who requires support on this topic.

  9. Thank you for each of your work on this web site. My daughter takes pleasure in managing investigation and it’s really easy to understand why. A lot of people hear all of the dynamic mode you produce simple items via this web site and even recommend response from some others on that concept so our child is becoming educated a great deal. Take pleasure in the remaining portion of the year. You have been conducting a powerful job.

  10. I wanted to type a simple comment to be able to express gratitude to you for all the marvelous tricks you are posting on this site. My considerable internet research has now been paid with brilliant know-how to share with my guests. I would assert that we website visitors are rather lucky to exist in a superb network with very many outstanding people with helpful techniques. I feel somewhat happy to have used your entire website page and look forward to tons of more pleasurable moments reading here. Thanks a lot once more for a lot of things.

  11. I have to show my thanks to this writer for rescuing me from this particular condition. Just after exploring throughout the world-wide-web and seeing views that were not helpful, I believed my entire life was gone. Living without the presence of strategies to the problems you’ve fixed through your report is a critical case, and the ones that could have in a negative way damaged my career if I hadn’t discovered your site. Your personal capability and kindness in handling all the things was precious. I’m not sure what I would have done if I had not come upon such a thing like this. I am able to at this point look forward to my future. Thanks for your time so much for your specialized and sensible guide. I will not hesitate to suggest the blog to any individual who should have support on this problem.

  12. I would like to express my appreciation to this writer just for rescuing me from this type of setting. Just after surfing throughout the the net and seeing principles that were not helpful, I thought my entire life was gone. Existing without the presence of answers to the issues you’ve solved as a result of your good article content is a crucial case, and the ones which might have adversely affected my entire career if I had not discovered your blog. Your own personal knowledge and kindness in dealing with the whole thing was crucial. I’m not sure what I would have done if I had not come upon such a solution like this. I’m able to at this point look forward to my future. Thank you so much for the professional and amazing guide. I won’t be reluctant to endorse your blog post to anybody who would need tips on this situation.

  13. A formidable share, I just given this onto a colleague who was doing a little evaluation on this. And he the truth is purchased me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the deal with! However yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love reading extra on this topic. If potential, as you develop into expertise, would you thoughts updating your blog with more details? It’s extremely useful for me. Big thumb up for this weblog post!

  14. I and also my pals came viewing the great hints on your website then unexpectedly I got a terrible suspicion I never thanked the blog owner for those techniques. My ladies had been totally stimulated to see them and have unquestionably been having fun with them. Appreciate your turning out to be simply helpful and also for deciding upon some important things millions of individuals are really desirous to understand about. Our honest regret for not saying thanks to sooner.

  15. I really wanted to make a brief note in order to express gratitude to you for all of the wonderful solutions you are giving here. My extensive internet search has at the end been paid with awesome suggestions to talk about with my friends and family. I would suppose that many of us readers actually are really blessed to dwell in a fine site with so many lovely people with valuable tips. I feel truly happy to have come across your entire site and look forward to so many more excellent times reading here. Thank you again for all the details.

  16. I intended to send you the very small observation so as to thank you very much as before regarding the fantastic guidelines you’ve contributed on this site. It was simply unbelievably open-handed with you in giving publicly precisely what a few people would have sold as an e-book to earn some money on their own, especially since you might have done it if you ever wanted. Those suggestions also served as the good way to realize that other people have the same desire just like my personal own to grasp great deal more with respect to this problem. I think there are millions of more pleasant times up front for individuals who look over your blog.

  17. I wanted to draft you the bit of observation to thank you so much yet again with the great pointers you’ve contributed in this article. This is simply strangely open-handed of you giving openly what some people might have offered for sale as an ebook to generate some money for themselves, particularly since you could possibly have done it in case you desired. The guidelines in addition served as a fantastic way to comprehend someone else have the identical eagerness just like my own to see good deal more concerning this issue. I’m sure there are thousands of more pleasurable situations ahead for those who read your website.

  18. My husband and i felt now lucky that Louis could conclude his preliminary research via the precious recommendations he was given from your weblog. It is now and again perplexing to just possibly be giving out things that other folks might have been selling. We really remember we need the blog owner to be grateful to because of that. Those illustrations you have made, the straightforward website menu, the relationships your site give support to create – it is most remarkable, and it is aiding our son in addition to our family reason why this theme is cool, which is certainly truly mandatory. Many thanks for the whole lot!

  19. I precisely desired to thank you very much all over again. I am not sure the things that I might have achieved in the absence of those creative ideas provided by you on such a subject. It was before a real intimidating situation in my position, however , encountering the specialised style you processed it made me to weep with gladness. I am thankful for the assistance and even hope you know what a powerful job you have been carrying out training people today through the use of your website. I am sure you haven’t got to know any of us.

  20. I precisely had to thank you very much yet again. I do not know the things that I would have gone through in the absence of the tricks contributed by you concerning this area of interest. It actually was the frightening difficulty in my circumstances, nevertheless seeing the specialised form you managed that took me to weep over contentment. Now i’m thankful for this work and in addition hope you know what a powerful job you are doing educating many people all through your web page. I know that you’ve never come across any of us.

  21. A powerful share, I simply given this onto a colleague who was doing a little bit analysis on this. And he actually purchased me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying extra on this topic. If potential, as you turn out to be experience, would you mind updating your blog with extra details? It is highly helpful for me. Huge thumb up for this blog put up!

  22. My husband and i ended up being really excited when Albert managed to complete his homework from the precious recommendations he came across in your weblog. It is now and again perplexing to simply find yourself giving out thoughts that men and women could have been selling. Therefore we take into account we’ve got you to give thanks to for that. Most of the illustrations you have made, the easy website navigation, the relationships you can make it possible to create – it is all powerful, and it is leading our son and us recognize that the issue is fun, which is certainly exceedingly indispensable. Many thanks for the whole lot!

  23. I definitely wanted to jot down a small word in order to thank you for these splendid strategies you are placing at this website. My time-consuming internet search has finally been paid with reliable ideas to exchange with my friends. I would state that that many of us visitors are unquestionably lucky to exist in a very good site with many lovely professionals with helpful solutions. I feel very fortunate to have encountered your weblog and look forward to plenty of more thrilling times reading here. Thank you once more for all the details.

  24. I really wanted to write down a simple note so as to express gratitude to you for all of the fantastic tips and hints you are posting here. My extensive internet investigation has now been rewarded with useful information to go over with my colleagues. I ‘d suppose that most of us visitors are undeniably blessed to live in a good place with so many lovely individuals with very beneficial guidelines. I feel very much lucky to have discovered your weblog and look forward to so many more brilliant minutes reading here. Thanks a lot once more for all the details.

  25. I definitely wanted to type a remark in order to thank you for all of the splendid strategies you are showing on this site. My time-consuming internet lookup has finally been rewarded with reasonable facts and techniques to go over with my family. I ‘d tell you that most of us website visitors are undeniably fortunate to live in a superb community with many wonderful professionals with beneficial strategies. I feel rather privileged to have come across the web pages and look forward to really more excellent moments reading here. Thanks once again for a lot of things.

  26. I have to express my thanks to the writer just for rescuing me from such a incident. Just after scouting throughout the the web and getting tips which were not powerful, I thought my entire life was done. Existing devoid of the strategies to the difficulties you have fixed all through your guideline is a crucial case, and the ones which might have in a wrong way damaged my career if I had not discovered your website. Your own personal mastery and kindness in maneuvering every aspect was precious. I am not sure what I would’ve done if I had not come across such a solution like this. I’m able to at this time relish my future. Thanks a lot so much for the professional and results-oriented help. I will not hesitate to propose the website to anybody who would like assistance about this situation.

  27. I wish to voice my appreciation for your kind-heartedness for men and women that have the need for help on this idea. Your very own commitment to getting the solution up and down came to be astonishingly effective and have without exception encouraged guys and women much like me to get to their pursuits. Your entire invaluable recommendations means much a person like me and additionally to my mates. Warm regards; from all of us.

  28. I would like to express some thanks to this writer for bailing me out of this particular condition. Just after browsing throughout the the net and coming across thoughts which were not productive, I figured my life was well over. Existing without the presence of strategies to the problems you’ve fixed through this post is a serious case, as well as the ones which could have in a wrong way damaged my career if I had not noticed your blog post. Your main competence and kindness in controlling everything was priceless. I’m not sure what I would have done if I had not discovered such a subject like this. It’s possible to now look ahead to my future. Thank you so much for your professional and sensible help. I will not think twice to propose the sites to any person who ought to have care about this area.

  29. I must convey my appreciation for your kind-heartedness giving support to people that have the need for help with that area of interest. Your special commitment to passing the solution along turned out to be particularly valuable and has enabled professionals just like me to get to their goals. Your new invaluable facts signifies a lot to me and even further to my office colleagues. With thanks; from all of us.

  30. The subsequent time I learn a blog, I hope that it doesnt disappoint me as much as this one. I imply, I know it was my choice to learn, but I truly thought youd have one thing interesting to say. All I hear is a bunch of whining about one thing that you would repair when you werent too busy in search of attention.

  31. I and also my buddies were viewing the good hints found on the website and so at once developed an awful feeling I never expressed respect to the site owner for those tips. These men became for this reason warmed to learn them and have now in actuality been taking advantage of them. Thank you for actually being well kind and for deciding on variety of superb tips millions of individuals are really desperate to understand about. Our sincere apologies for not expressing gratitude to earlier.

Leave a Reply

Your email address will not be published.