This project demonstrates connecting PHP to MySQL using PDO, fetching rows with a prepared statement, and rendering them in a Bootstrap styled table using alternative PHP syntax.
This page includes content assisted by AI tools, reviewed and edited for accuracy.
db_connect.php— Secure PDO connection (ERRMODE_EXCEPTION, utf8mb4, assoc fetch mode)userModel.php—getAllUsers(PDO $pdo): arrayreturns all rows fromuserstableuserView.php— Renders a Bootstrap table (semantic, accessible) with alt PHP syntaxheader.php/footer.php— Shared layout with CodeStream Solutions branding
- Log in to phpMyAdmin: https://mywebtraining.net/webdev/phpmyadmin/
- Select your database: sherd_Lykos45.
- Run this SQL to create and populate users:
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO users (name, email) VALUES
('Stephen Herd', 'sherd@dcccd.edu'),
('Santa Claus', 'sc@npole.com'),
('Easter Bunny', 'ebunny@fluffy.com');Upload the entire php-with-mysql/ folder to your class server
/webdev/Lykos45/php-with-mysql/
Then open:
https://mywebtraining.net/webdev/Lykos45/php-with-mysql/userView.php