john_jack Posted December 16, 2015 Share Posted December 16, 2015 hi , i folowed the tutorial on Appml : http://www.w3schools.com/appml/appml_php.asp but i am getting an error . my question is : does anyone know what is wrong with this ? if not is there a way to get more info about the error so ill try to fix it . Heres the Screen shot : Thank You Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2015 Share Posted December 16, 2015 We need more information than a image, supplying the code you are actually using would be a better approach. Link to comment Share on other sites More sharing options...
john_jack Posted December 16, 2015 Author Share Posted December 16, 2015 thank you for your response , i am actualy folowing the tutorial mentioned above ,but heres the code : the html page : <!DOCTYPE html> <html lang="en"> <title>Customers</title> <link rel="stylesheet" href= "http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="http://www.w3schools.com/appml/2.0.3/appml.js"></script> <body> <div class="container" appml-data="appml.php?model=customers"> <h1>Customers</h1> <table class="table table-striped table-bordered"> <tr> <th>Customer</th> <th>City</th> <th>Country</th> </tr> <tr appml-repeat="records"> <td>{{CustomerName}}</td> <td>{{City}}</td> <td>{{Country}}</td> </tr> </table> </div> </body> </html> customer.js code : { "rowsperpage" : 10, "database" : { "connection" : "mydatabase", "sql" : "SELECT * FROM Customers", "orderby" : "CustomerName" } } appml_config.php <?php echo("Access Forbidden");exit();?> { "dateformat" : "yyyy-mm-dd", "databases" : [{ "connection" : "mydatabase", "host" : "localhost", "dbname" : "test", "username" : "root2", "password" : "toor" }] } also using the appml.php 2.0.3 the one available for download on the TUtorial Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2015 Share Posted December 16, 2015 And create_customers.js? Link to comment Share on other sites More sharing options...
john_jack Posted December 16, 2015 Author Share Posted December 16, 2015 i created it teh databse directly from mysql coz the create_customers not working . the point is my database is created and populated .yet not retriving data. thanks Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2015 Share Posted December 16, 2015 No, the point is i don't know what you have done, and i am trying to establish what you have or have not done to cause this problem, did you mention anything about the create_customer.js No! did you say you created the database manually No! just gave us a image, then showed us your code after I! asked for it. Link to comment Share on other sites More sharing options...
john_jack Posted December 16, 2015 Author Share Posted December 16, 2015 i folowed the tutorial as it was at first but didnt work ,didnt create the database .so i though maybe if i created it it will resolve the issue but sadly no . i used the sql provided in create_customer.js to create the table . when i use a php file to retrive data and make the result as json it works . i know these kinda tutorials are usualy to be 100% working ,but idk man ! thats why i asked if theres a way to get more details about the error somehow :s anything else i can provide you that might help? Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2015 Share Posted December 16, 2015 Show collation of fields?, they should be 'ut8_general_ci' using this sql automatically resets it to this DROP TABLE IF EXISTS customers; CREATE TABLE IF NOT EXISTS customers (CustomerID INT(6) NOT NULL PRIMARY KEY AUTO_INCREMENT,CustomerName NVARCHAR(255),ContactName NVARCHAR(255),Address NVARCHAR(255),City NVARCHAR(255),PostalCode NVARCHAR(255),Country NVARCHAR(255)); INSERT INTO customers(CustomerName,ContactName,Address,City,PostalCode,Country)VALUES ("Alfreds Futterkiste","Maria Anders","Obere Str. 57","Berlin","12209","Germany"); INSERT INTO customers(CustomerName,ContactName,Address,City,PostalCode,Country)VALUES ("Around the Horn","Thomas Hardy","120 Hanover Sq.","London","WA1 1DP","UK"); INSERT INTO customers(CustomerName,ContactName,Address,City,PostalCode,Country)VALUES ("Blauer See Delikatessen","Hanna Moos","Forsterstr. 57","Mannheim","68306","Germany"); I followed tutorial, did the same as you and entered data with above, opened new customers.html (end of tutorial) and it worked fine, it requires unicode character set, using NVARCHAR causes it use required collation of 'ut8_general_ci' Also if using windows o/s it will forgive you for using 'Customers' instead of 'customers' (phpmyadmin changes it to all lowercase unless you change settings to disable it) while other O/S or web host server will be less forgiving and treat it as a different table. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 16, 2015 Share Posted December 16, 2015 <?php echo("Access Forbidden"); exit(); //Note: dbname value all lowercase because phpmyadmin ?> { "dateformat" : "yyyy-mm-dd", "databases" : [{ "connection" : "mydatabase", "host" : "xxxxxxxx", "dbname" : "demodb", "username" : "xxxxxxx", "password" : "xxxxxxx" }] } Note: lowercase of table name { "rowsperpage" : 10, "database" : { "connection" : "mydatabase", "sql" : "SELECT * FROM customers", "orderby" : "CustomerName" } } <!DOCTYPE html> <html lang="en"> <title>Customers</title> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="http://www.w3schools.com/appml/2.0.3/appml.js"></script> <body> <div class="container" appml-data="appml.php?model=customers"> <h1>Customers</h1> <table class="table table-striped table-bordered"> <tr> <th>Customer</th> <th>City</th> <th>Country</th> </tr> <tr appml-repeat="records"> <td>{{CustomerName}}</td> <td>{{City}}</td> <td>{{Country}}</td> </tr> </table> </div> </body> </html> appml.php as downloaded Link to comment Share on other sites More sharing options...
dsonesuk Posted December 17, 2015 Share Posted December 17, 2015 It can also depend on how you saved these files, if you use proper php/html editor it would saved them by default using utf-8 encoding, windows notpad unless specifically selected or mac text editor by changing saving settings will most likley save as ascii encoded. 1 Link to comment Share on other sites More sharing options...
john_jack Posted December 17, 2015 Author Share Posted December 17, 2015 Oh man i ,i was about to tell you still didnt work!! and you posted the thing about the encoding and that was it man ; UTF8 ftw thanks a lot for your help it works like a charme now . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now