AppML PHP (ok)

https://www.w3schools.com/appml/appml_php.asp

C:\xampp\htdocs\abc\customers.htm

<!DOCTYPE html>
<html lang="en">
<title>Customers</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>
<body>
  <div class="w3-container" appml-data="appml.php?model=model_customers">
    <h1>Customers</h1>
    <table class="w3-table-all">
      <tr>
        <th>Customer</th>
        <th>City</th>
        <th>Country</th>
      </tr>
      <tr appml-repeat="records">
        <td>{{CompanyName}}</td>
        <td>{{City}}</td>
        <td>{{Country}}</td>
      </tr>
    </table>
  </div>
</body>
</html>

C:\xampp\htdocs\abc\create_customers.htm

<!DOCTYPE html>
<html>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://www.w3schools.com/appml/2.0.3/appml.js"></script>
<script type="text/javascript" src="create_customers.js"></script>
<body>
  <div appml-data="appml.php?model=create_customers"></div>
</body>
</html>

C:\xampp\htdocs\abc\create_customers.js

{
  "database": {
    "connection": "mydatabase",
    "execute": [
      "DROP TABLE IF EXISTS customers",
      "CREATE TABLE `appml`.`customers` ( `CustomerID` INT(10) NULL AUTO_INCREMENT , `CompanyName` VARCHAR(100) NOT NULL , `ContactName` VARCHAR(100) NOT NULL , `Address` VARCHAR(100) NOT NULL , `City` VARCHAR(100) NOT NULL , `PostalCode` VARCHAR(100) NOT NULL , `Country` VARCHAR(100) NOT NULL , PRIMARY KEY (`CustomerID`)) ENGINE = InnoDB",
      "INSERT INTO customers(CompanyName,ContactName,Address,City,PostalCode,Country) VALUES (\"Alfreds Futterkiste\",\"Maria Anders\",\"Obere Str. 57\",\"Berlin\",\"12209\",\"Germany\")",
      "INSERT INTO customers(CompanyName,ContactName,Address,City,PostalCode,Country) VALUES (\"Around the Horn\",\"Thomas Hardy\",\"120 Hanover Sq.\",\"London\",\"WA1 1DP\",\"UK\")",
      "INSERT INTO customers(CompanyName,ContactName,Address,City,PostalCode,Country) VALUES (\"Blauer See Delikatessen\",\"Hanna Moos\",\"Forsterstr. 57\",\"Mannheim\",\"68306\",\"Germany\")"
    ]
  }
}

C:\xampp\htdocs\abc\appml_config.php

<?php echo ("Access Forbidden");exit(); ?>
{
	"dateformat" : "yyyy-mm-dd",
	"databases" : [{
    "connection" : "mydatabase",
    "host" : "localhost",
    "dbname" : "appml",
    "username" : "root",
    "password" : ""
	}]
}

C:\xampp\htdocs\abc\model_customers.js

{
  "rowsperpage": 10,
  "database": {
    "connection": "mydatabase",
    "sql": "SELECT * FROM Customers"
  }
}

Last updated