-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_db.php
More file actions
33 lines (28 loc) · 1.09 KB
/
check_db.php
File metadata and controls
33 lines (28 loc) · 1.09 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
<?php
// Quick database check script
define('WP_USE_THEMES', false);
require_once('../../../../../wp-load.php');
global $wpdb;
$table = $wpdb->prefix . 'ai_pulse_content';
// Check if table exists
$table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$table}'");
echo "Table exists: " . ($table_exists ? "YES" : "NO") . "\n";
if ($table_exists) {
// Check table structure
$columns = $wpdb->get_results("DESCRIBE {$table}");
echo "\nTable structure:\n";
foreach ($columns as $col) {
echo " - {$col->Field} ({$col->Type})\n";
}
// Check row count
$count = $wpdb->get_var("SELECT COUNT(*) FROM {$table}");
echo "\nTotal rows: {$count}\n";
// Show recent entries
if ($count > 0) {
$recent = $wpdb->get_results("SELECT id, keyword, mode, period, generated_at, is_active FROM {$table} ORDER BY generated_at DESC LIMIT 5");
echo "\nRecent entries:\n";
foreach ($recent as $row) {
echo " ID: {$row->id}, Keyword: {$row->keyword}, Mode: {$row->mode}, Active: {$row->is_active}, Generated: {$row->generated_at}\n";
}
}
}