Creating an Iterator for While Loop Forms in PHP/MySQL PHP Script


Creating an Iterator for While Loop Forms in PHP/MySQL PHP Script

This tutorial will teach you on how to create iterator to use in while loops form to identify that a certain element of a form is associated with another element. In the case of this tutorial, we use iterator to associate our text with the selected product’s id.

Creating our Database

First step is to create our database.
1. Open phpMyAdmin.
2. Click databases, create a database and name it as test.
3. After creating a database, click the SQL and paste the below codes. See image below for detailed instruction.

 

  1. CREATE TABLE `details` (
  2. `detailsid` INT(11) NOT NULL AUTO_INCREMENT,
  3. `purchaseid` INT(11) NOT NULL,
  4. `productid` INT(11) NOT NULL,
  5. `quantity` DOUBLE NOT NULL,
  6. PRIMARY KEY(`detailsid`)
  7. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  8. CREATE TABLE `product` (
  9. `productid` INT(11) NOT NULL AUTO_INCREMENT,
  10. `product_name` VARCHAR(50) NOT NULL,
  11. `price` DOUBLE NOT NULL,
  12. PRIMARY KEY(`productid`)
  13. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  14. CREATE TABLE `purchase` (
  15. `purchaseid` INT(11) NOT NULL AUTO_INCREMENT,
  16. `name` VARCHAR(50) NOT NULL,
  17. `total` DOUBLE NOT NULL,
  18. `date` datetime NOT NULL,
  19. PRIMARY KEY(`purchaseid`)
  20. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  21. INSERT INTO `product` (`productid`, `product_name`, `price`) VALUES
  22. (4, ‘Laptop’, 699.99),
  23. (5, ‘Desktop Pc’, 999.99),
  24. (6, ‘Tablet’, 299.99);

 

 

 

 

Read Me

 



Find More Creating an Iterator for While Loop Forms in PHP/MySQL PHP Script

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Website

Wordpress  Create Free Website (Web Builder)
Uploadfile  Upload File Website (Unlimited)
Mobilelist  Mobile Price Website (Mobilelop)
Blog  Create Blog Website (Wapfo)
Wapbuilder  Create Free Wapsite (Wapbuilder)