You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phprequire_once__DIR__ . '/../app/cli-config.php';
$table = MysqliDb::$prefix . 'users';
if (!$db->tableExists($table)) {
$query = "CREATE TABLE IF NOT EXISTS `{$table}` ( `id` INT AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(100) NOT NULL, `email` VARCHAR(150) NOT NULL UNIQUE, `password` VARCHAR(255) NOT NULL, `token` VARCHAR(255) DEFAULT NULL, `photo` VARCHAR(255) DEFAULT NULL, `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ";
echo"🔧 Running SQL:\n$query\n";
$db->rawQuery($query) ;
if ($db->tableExists($table)) {
echo"✅ Table '$table' created successfully.\n";
} else {
echo"❌ Failed to create table '$table'.\n";
}
} else {
echo"⚠️ Table '$table' already exists.\n";
}
CREATETABLEIF NOT EXISTS `Ydnujs_users` (
`id`INT AUTO_INCREMENT PRIMARY KEY,
`name`VARCHAR(100) NOT NULL,
`email`VARCHAR(150) NOT NULL UNIQUE,
`password`VARCHAR(255) NOT NULL,
`token`VARCHAR(255) DEFAULT NULL,
`photo`VARCHAR(255) DEFAULT NULL,
`created_at`TIMESTAMPNOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at`TIMESTAMPNOT NULL DEFAULT CURRENT_TIMESTAMPONUPDATECURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
mysqli_sql_exception {#14
#message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Ydnujs_CURRENT_TIMESTAMP, `updated_at` TIMESTAMP NOT
NULL DEFAULT Ydnujs_CURRENT' at line 1"
The text was updated successfully, but these errors were encountered:
My code has an error when I use prefix and changes the CURRENT_TIMESTAMP variable? What is the problem?
php v =8.4.3
mysqlv=5.7.33
faremework = https://github.com/flare-framework/Flare/
The text was updated successfully, but these errors were encountered: