Spaces:
Runtime error
Runtime error
feat(membership): admin-driven account creation, real estate tier/investment work, in-progress monorepo migration state
b2dcf0f | declare(strict_types=1); | |
| $mode = $argv[1] ?? ''; | |
| $sql = getenv('MDN_SQL') ?: ''; | |
| $params = []; | |
| $paramCount = (int) (getenv('MDN_PARAM_COUNT') ?: 0); | |
| for ($index = 0; $index < $paramCount; $index++) { | |
| $params[] = getenv('MDN_PARAM_'.$index); | |
| } | |
| $pdo = new PDO( | |
| 'mysql:host='.getenv('MDN_DB_HOST').';dbname='.getenv('MDN_DB_NAME').';charset=utf8mb4', | |
| getenv('MDN_DB_USER'), | |
| getenv('MDN_DB_USER_PASS'), | |
| [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION], | |
| ); | |
| $interpolatedSql = $sql; | |
| foreach ($params as $value) { | |
| $quoted = $value === null ? 'NULL' : $pdo->quote((string) $value); | |
| $interpolatedSql = preg_replace('/\?/', $quoted, $interpolatedSql, 1); | |
| } | |
| $stmt = $pdo->query($interpolatedSql); | |
| if ($mode === 'scalar') { | |
| $value = $stmt->fetchColumn(); | |
| if ($value !== false) { | |
| echo $value; | |
| } | |
| } | |