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"; //hosting name of database
12. $db_uname = "root"; //user name of database
13. $db_pword = ""; //password of user database
14. $db_name = "eod"; // database name
15. $link = mysql_connect($db_hname, $db_uname, $db_pword) or die("Not Success ....!");//connection of database
16. if (!$link) { die('Could not connect: ' . mysql_error()); } //error handling possiblity
17. mysql_select_db($db_name); //select function for database selection to using
18.
19. // --------------------------------------------------------------------------------
20. // STEP 3. ACTIVATE THE TABLE
21. // --------------------------------------------------------------------------------
22. $tb_produk = mysql_query("SELECT * FROM tbproduk");
23. // STEP 4. VIEW THE RECORD OF TABLE
24. $tbv_product = mysql_fetch_array($tb_produk);
25. // some of script must using :: mysql_fetch_array('tb_produk')
26. // update php.ini
27. // --------------------------------------------------------------------------------
28.
29. echo 'Product Information
';
30. echo 'Name : '.$tbv_product['nprod'].'< br >';
31. echo 'ID : '.$tbv_product['kprod'].'< br >';
32. echo 'Price : USD '.number_format($tbv_product['hprod'], 2, '.', ',').'< br >';
33. echo 'Stock : '.$tbv_product['pstock'].'< br >';
34.
35. // --------------------------------------------------------------------------------
36. // The Result of script running
37. // --------------------------------------------------------------------------------
38. Product Information
39. Name : Acer Aspire One AO522-AMD
40. ID : 0203ka03-001
41. Price : USD 2,699,000.00
42. Stock : 1
43. // --------------------------------------------------------------------------------
44. ? >
Please keep in mind.
If you have more than one data record,
and you use the script above program,
then the data will appear on your page is just one record of data.
How to display data from more than one data?
Visit the following links:
1 comment:
I have read your blog its very attractive and impressive. I like it your blog.
PHP 7 Training in chennai | PHP 7 Training Course
PHP 7 Training in chennai |
Online PHP 7 Course
Post a Comment