-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_fivem_db.php
More file actions
46 lines (40 loc) · 1.59 KB
/
check_fivem_db.php
File metadata and controls
46 lines (40 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
try {
// Try to connect to FiveM database (MySQL based on config)
$dsn = "mysql:host=localhost;port=3306;dbname=db_fivemtest";
$pdo = new PDO($dsn, 'root', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected to FiveM database successfully!\n";
// Check if users table exists
$stmt = $pdo->query("SHOW TABLES LIKE 'users'");
if ($stmt->rowCount() > 0) {
echo "✅ users table exists in FiveM database\n";
// Get some basic info
$stmt = $pdo->query("SELECT COUNT(*) as count FROM users");
$count = $stmt->fetch(PDO::FETCH_ASSOC);
echo "Records in users table: {$count['count']}\n";
// Show table structure
$stmt = $pdo->query("DESCRIBE users");
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "\nusers table structure:\n";
foreach ($columns as $column) {
echo "- {$column['Field']}: {$column['Type']}\n";
}
} else {
echo "❌ users table does not exist in FiveM database\n";
// Show what tables do exist
$stmt = $pdo->query("SHOW TABLES");
$tables = $stmt->fetchAll(PDO::FETCH_COLUMN);
echo "Available tables:\n";
foreach ($tables as $table) {
echo "- $table\n";
}
}
} catch (PDOException $e) {
echo "❌ Could not connect to FiveM database: " . $e->getMessage() . "\n";
echo "This might be because:\n";
echo "1. MySQL is not running in Laragon\n";
echo "2. The database 'db_fivemtest' doesn't exist\n";
echo "3. Connection credentials are wrong\n";
}
?>