Browse Source

Prevent fetching many rows to check table existance

Mathieu Leplatre 10 years ago
parent
commit
c15e63d204
1 changed files with 2 additions and 2 deletions
  1. 2 2
      php/modules/db.php

+ 2 - 2
php/modules/db.php

@@ -22,7 +22,7 @@ function dbConnect() {
 
 	if (!$database->select_db($dbName))
 		if (!createDatabase($dbName, $database)) exit('Error: Could not create database!');
-    if (!$database->query("SELECT * FROM lychee_photos, lychee_albums, lychee_settings;"))
+    if (!$database->query("SELECT * FROM lychee_photos, lychee_albums, lychee_settings LIMIT 1;"))
     	if (!createTables($database)) exit('Error: Could not create tables!');
 
     // Avoid sql injection on older MySQL versions
@@ -183,4 +183,4 @@ function createTables($database) {
 
 }
 
-?>
+?>