Advanced Search
Search Results
114 total results found
Inserting Imported Rows Safely
Prepare the insert once, then execute it for each valid row. $insert = $pdo->prepare( "INSERT INTO team_results (match_id, team_name, wins, losses) VALUES (:match_id, :team_name, :wins, :losses)" ); $insert->execute([ "match_id" => $matchId, "...
New Page
Reporting CSV Import Results
An administrator needs evidence of what happened, not just “upload complete”. Report useful totals Show the escaped filename, rows read, inserted, updated, skipped and rejected, plus row-specific validation messages and whether a transaction committed or rolle...
Building a Complete Admin CSV Import
A complete import combines access control, upload checks, parsing, row validation, prepared statements and a result summary. Processing sequence Start the session and require the administrator role. Accept a POST upload. Validate upload status, size and extens...
Testing an Admin CSV Import
Testing must cover permissions, validation, database effects and feedback. Test Condition Expected result Logged out Direct import URL Redirect to login Standard role Direct URL or POST 403; nothing imported Valid CSV Correct headings and rows Expected records...
Querying Data for a User Need
A query is meaningful when it answers a user question. Begin with the need, then choose fields, filters, calculations and order. Example need A participant wants to find the strongest fictional teams and inspect their performance. SELECT team_name, SUM(...
Building a Leaderboard
A leaderboard converts stored results into a ranked, understandable output. SELECT team_name, SUM(wins) AS wins, SUM(losses) AS losses, SUM(wins) * 3 AS points FROM team_results GROUP BY team_name ORDER BY points DESC, wins DESC, team_name...
Calculating Summary Statistics
Statistics reduce a dataset to information users can interpret. SELECT COUNT(*) AS result_count, COUNT(DISTINCT team_name) AS team_count, SUM(wins) AS total_wins, AVG(wins) AS average_wins, MAX(wins) AS highest_wins FROM team_results; Choose statisti...
Creating Match and Player Views
A detail view lets a user move from a summary to the record needed for a task. Receive a validated identifier $matchId = trim($_GET["match_id"] ?? ""); if ($matchId === "" || mb_strlen($matchId) > 20) { exit("Invalid match."); } $stmt = $pdo->prepare( "S...
Creating Charts from Processed SQL Data
A chart is useful only when it makes a comparison or pattern easier to understand. JavaScript is a supporting technology; the assessed reasoning lies in the data choice, processing and justified output. Prepare data in PHP $labels = array_column($rows, "team_n...
Exporting Processed Data to CSV
CSV export can support download and reuse of a filtered or processed result. It is optional when import already satisfies the data-transfer requirement, but can be valuable for a justified user need. Send download headers header("Content-Type: text/csv; charse...
Connecting a CSS Stylesheet
CSS controls presentation while HTML provides structure. Connect the file Create css/style.css, then add this inside the page’s <head>: <link rel="stylesheet" href="css/style.css"> A relative path is interpreted from the current page. A PHP page in a subfold...
CSS Selectors, Classes and Reusable Rules
Selectors identify the HTML elements a rule styles. body { margin: 0; } h1 { color: #123f73; } .card { border: 1px solid #cbd5e1; } #main-search { max-width: 40rem; } nav a:hover, nav a:focus-visible { text-decoration: underline; } Use element selectors for br...
CSS Box Model and Spacing
Every element is a box made from content, padding, border and margin. *, *::before, *::after { box-sizing: border-box; } .card { max-width: 42rem; padding: 1rem; border: 1px solid #cbd5e1; margin-block: 1rem; } With border-box, declared width includ...
Responsive Layouts with Flexbox and Grid
Responsive layouts adapt to available space rather than one device size. Flexbox navigation .navigation { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; } Grid cards .card-grid { display: grid; grid-template-columns: repeat(auto...
Accessible Colour, Typography and Focus
Accessible styling supports perception, reading and keyboard use. body { color: #1f2933; background: #ffffff; font-family: system-ui, sans-serif; line-height: 1.6; } a { color: #075985; } :focus-visible { outline: 3px solid #f59e0b; outline-offset:...
Styling Forms and Validation Messages
Form styling should make labels, controls, instructions and errors easy to identify. .form-group { display: grid; gap: 0.35rem; margin-block: 1rem; } input, select, button { font: inherit; min-height: 2.75rem; } input { border: 1px solid #64748b; ...
Styling Tables, Navigation and Data Displays
Data interfaces should prioritise interpretation over decoration. .table-wrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; } th, td { padding: 0.65rem; border: 1px solid #cbd5e1; text-align: left; } th { background: #123f73; ...