Skip to content
Advertisement

Filling boostrap cards with data from a mySQL database

I am trying to fill bootstrap cards with data from a database. I am very close. I have the mainphp file called project.php

A file with a function called component to fill them, called component.php.

And a connectDB.php file, that connect the DB and extracts the information from a table.

I am aware this is alot of code so I highlighted 2 areas the problem is definitely in…Apologies if too much, I can remove the function if necessary as it works..

here is an extract from project.php

JavaScript

This component definitely works as I tested it

JavaScript

and finally here is the connectDB.php

JavaScript

I am awar the problem is somewhere in the connection step. I am very new to php in general and have been at this very long, I would appreciate help!

Advertisement

Answer

You have a function getData() that has "$this->table". Dont copy paste the codes without understanding what it does.

Clean up your connectDB.php:

JavaScript

In project.php:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement