Custom Search

News World

May 15, 2011

Showing Some Data With PHP Script

1. < ? php
2. // STEP 1. CREATE DATABASE
3. // --------------------------------------------------------------------------------
4. // create database : eod
5. // create table : tbproduk
6. // create field on table tbproduk :
7. // idp kprod nprod hprod sprod gprod tprod pstatus pview pstock
8. // --------------------------------------------------------------------------------
9. // STEP 2. ACTIVATE OF DATABASE
10. // --------------------------------------------------------------------------------
11. $db_hname = "localhost";
12. $db_uname = "root";
13. $db_pword = "";
14. $db_name = "eod";
15. $link = mysql_connect($db_hname, $db_uname, $db_pword) or die("Not Success ....!");
16. if (!$link) { die('Could not connect: ' . mysql_error()); }
17. mysql_select_db($db_name);
18.
19. if($_GET['rto']==''){
20. $rt = 1;
21. }else{
22. $rt = $_GET['rto'];
23. }
24.
25. echo 'Record : '.$rt.'
';
26. $tb_produkm = mysql_query("SELECT * FROM tbproduk");
27. $tb_produk = mysql_query("SELECT * FROM tbproduk LIMIT ".$rt." , 1");
28. echo "SELECT * FROM tbproduk LIMIT ".$rt." , 1< br >";
29. $rtb_produk = mysql_num_rows($tb_produkm);
30. echo 'Product Information
';
31. echo 'No/Product Name/ Product ID/ Total Stock/Product Price';
32. echo '< br >';
33. echo '---------------------------------------------------------------------------< br >';
34. $tbv_product = mysql_fetch_array($tb_produk);
35.
36. echo 'Product : '.$rt.'/'.$tbv_product['nprod'].'/'.$tbv_product['kprod'].'/'.$tbv_product['pstock'].'/';
37. echo ' USD '.number_format($tbv_product['hprod'], 2, '.', ',').'< br >';
38. echo '---------------------------------------------------------------------------< br >< br >';
39.
40. //----------------------------------------------------------
41. // Next Data and Previous Data Process
42. //----------------------------------------------------------
43. if ($_GET['rto']>1){
44. ? >
45. [< a href ='?rto=< ? php echo $rt-1;? >'>Previous Data< /a >]
46. < ? php
47. }else{
48. echo '[Previous Data]';
49. }
50.
51. if ($_GET['rto']< $rtb_produk-1){
52. ? >
53. [< a href ='?rto=< ? php echo 1+$rt;? >'>Next Data< /a >]
54. < ? php
55. }else{
56. echo '[Next Data]';
57. }
58. ? >

No comments:

IT Conversations

Moneycontrol Latest News

Latest new pages on Computer Hope

Latest from Infoworld

Door Lock

Door Lock Import Top Door Lock from China Contact Quality Manufacturers Now