How to show data on Mat table from PHP and mysql

Hello community. I am new to Angular and I want to show data on Mat table using PHP and mysql. Can anyone help me?

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

Yah sure, I am getting these errors and below is my code as well

Error:
Brother there are 5 errors on app.component.ts file

  1. Line 16, A class member cannot have the ‘const’ keyword.ts(1248)
  2. Line 21, Argument of type ‘Object’ is not assignable to parameter of type ‘Applications’.
    The ‘Object’ type is assignable to very few other types. Did you mean to use the ‘any’ type instead?
    Type ‘Object’ is missing the following properties from type ‘Applications’: id, email, username
  3. Line 22, Property ‘displayedColumns’ does not exist on type ‘AppComponent’.ts(2339)
  4. Line 23,Property ‘dataSource’ does not exist on type ‘AppComponent’.ts(2339)
  5. Line 23, Argument of type ‘Applications’ is not assignable to parameter of type ‘unknown’.
    Type ‘Applications’ is missing the following properties from type ‘unknown’: length, pop, push, concat, and 26 more
  1. import {Component, OnInit, ViewChild} from ‘@angular/core’;
  2. import {MatSort, MatTableDataSource, MatPaginator} from ‘@angular/material’;
  3. import { HttpClient } from ‘@angular/common/http’;
  4. export interface Applications {
  5. id: number;
  6. email: string;
  7. username: string;
  8. }
  9. @Component({
  10. selector: ‘app-root’,
  11. templateUrl: ‘./app.component.html’,
  12. styleUrls: [’./app.component.css’]
  13. })
  14. export class AppComponent {
  15. posts: any;
  16. public const apps: Applications = new Array();
  17. title = ‘my-angular-app’;
  • constructor(private http: HttpClient) {
  1. this.http.get(‘my localhost php file’).subscribe(data => {
  2. this.apps.push(data);
  3. this.displayedColumns = [‘id’, ‘email’, ‘username’];
  4. this.dataSource = new MatTableDataSource(this.apps[0]);
  5. }, error => console.error(error));
  6. }
  7. }

Can you indent your code and remove the line numbers from it? You can just edit your post.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

Thank you