-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_db.php
More file actions
47 lines (43 loc) · 1.59 KB
/
Copy pathcheck_db.php
File metadata and controls
47 lines (43 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
47
<?php
include_once 'includes/config.php';
// Check laptop table structure
echo "<h2>Laptop Table Structure</h2>";
$query = "DESCRIBE `Laptops`";
$result = mysqli_query($conn, $query);
echo "<table border='1'>";
echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th><th>Extra</th></tr>";
while ($row = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>{$row['Field']}</td>";
echo "<td>{$row['Type']}</td>";
echo "<td>{$row['Null']}</td>";
echo "<td>{$row['Key']}</td>";
echo "<td>{$row['Default']}</td>";
echo "<td>{$row['Extra']}</td>";
echo "</tr>";
}
echo "</table>";
// Check sample data from laptop table
echo "<h2>Sample Laptop Data</h2>";
$query = "SELECT * FROM `Laptops` LIMIT 2";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
echo "<pre>";
print_r($row);
echo "</pre>";
} else {
echo "No laptop data found.";
}
// Check if small description exists
echo "<h2>Count of Null/Empty Small Descriptions</h2>";
$query = "SELECT COUNT(*) as count FROM `Laptops` WHERE `Laptops_small_description` IS NULL OR `Laptops_small_description` = ''";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
echo "Laptops with missing descriptions: {$row['count']}";
// Check if name exists
echo "<h2>Count of Null/Empty Names</h2>";
$query = "SELECT COUNT(*) as count FROM `Laptops` WHERE `Laptops_name` IS NULL OR `Laptops_name` = ''";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
echo "Laptops with missing names: {$row['count']}";