' . h($title) . '
' . h($sql) . '
'; $r = db_query($sql); if (!$r) { echo '

Query failed' . (function_exists('db_error') ? ': ' . h(db_error()) : '') . '

'; return; } $rows = []; while ($row = db_fetch_assoc($r)) { $rows[] = $row; } if (!$rows) { echo '

No rows.

'; return; } echo ''; foreach (array_keys($rows[0]) as $col) { echo ''; } echo ''; foreach ($rows as $row) { echo ''; foreach ($row as $col => $val) { if ($val === null) { echo ''; } elseif (in_array($col, $truncate, true)) { echo ''; } else { echo ''; } } echo ''; } echo '
' . h($col) . '
NULL' . h(substr((string)$val, 0, 12)) . '…' . nl2br(h($val)) . '
'; } $school = trim((string)($_GET['school'] ?? 'Development School')); ?> Square — Check

Square — Check

⚠️ Temporary diagnostic page — delete square_check.php from the server when finished.
Host database layer (db_query) is not available — cannot read.

'; } else { $s = db_escape_string($school); showQuery('School row', "SELECT record_num, school_name, square_merchant_id, square_access_token IS NOT NULL AS has_token, square_ready, square_location_id, square_authorization_revoked, square_status_issues FROM schools WHERE school_name = '$s'"); showQuery('Latest onboarding attempts', "SELECT state, school_num, status, merchant_id, FROM_UNIXTIME(created_at) AS created, FROM_UNIXTIME(last_callback) AS callback FROM square_pending_onboarding ORDER BY created_at DESC LIMIT 5", ['state']); } ?>