Skip to content

Lykos45/Connecting-to-MySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP + MySQL User Directory (PDO)

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.

Files

  • db_connect.php — Secure PDO connection (ERRMODE_EXCEPTION, utf8mb4, assoc fetch mode)
  • userModel.phpgetAllUsers(PDO $pdo): array returns all rows from users table
  • userView.php — Renders a Bootstrap table (semantic, accessible) with alt PHP syntax
  • header.php / footer.php — Shared layout with CodeStream Solutions branding

Setup (phpMyAdmin)

  1. Log in to phpMyAdmin: https://mywebtraining.net/webdev/phpmyadmin/
  2. Select your database: sherd_Lykos45.
  3. 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');

Deploy

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages