diff --git a/ChangeLog b/ChangeLog index 0b8b29fde..96f7d6881 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-06-26 Marc Delisle + * bug 434608, dashes in db name: db_create.php3, lib.inc.php3, + db_details.php3 + 2001-06-26 Steve Alberty * lib.inc.php3: add 3 new Constants: PHPMYADMIN_VERSION, PHP_WINDOWS, PHP_INT_VERSION diff --git a/db_create.php3 b/db_create.php3 index 6fd225891..450cfc11b 100755 --- a/db_create.php3 +++ b/db_create.php3 @@ -6,7 +6,7 @@ require("./grab_globals.inc.php3"); require("./header.inc.php3"); -$result = mysql_query("CREATE DATABASE $db") or mysql_die(); +$result = mysql_query("CREATE DATABASE `$db`") or mysql_die(); $message = "$strDatabase $db $strHasBeenCreated"; require("./db_details.php3"); diff --git a/db_details.php3 b/db_details.php3 index 219e07f1b..b66dbb684 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -19,7 +19,7 @@ $num_tables = @mysql_numrows($tables); if ($num_tables>0 && MYSQL_MAJOR_VERSION>=3.23 && intval(MYSQL_MINOR_VERSION)>=3){ // Special speedup for newer MySQL Versions if ($cfgSkipLockedTables==true && MYSQL_MAJOR_VERSION==3.23 && intval(MYSQL_MINOR_VERSION)>=30){ // in 4.0 format changed - $query="SHOW OPEN TABLES from $db"; + $query="SHOW OPEN TABLES from `$db`"; $result=mysql_query($query); // Blending out tables in use if ($result!=false && mysql_num_rows($result)>0){ @@ -32,12 +32,12 @@ if ($num_tables>0 && MYSQL_MAJOR_VERSION>=3.23 && intval(MYSQL_MINOR_VERSION)>=3 mysql_free_result($result); if (isset($sot_cache)){ - $query="show tables from $db"; + $query="show tables from `$db`"; $result=mysql_query($query); if ($result!=false && mysql_num_rows($result)>0){ while ($tmp=mysql_fetch_array($result)){ if (!isset($sot_cache[$tmp[0]])){ - $sts_result=mysql_query("show table status from $db like '".AddSlashes($tmp[0])."'"); + $sts_result=mysql_query("show table status from `$db` like '".AddSlashes($tmp[0])."'"); $sts_tmp=mysql_fetch_array($sts_result); $tbl_cache[]=$sts_tmp; } @@ -53,7 +53,7 @@ if ($num_tables>0 && MYSQL_MAJOR_VERSION>=3.23 && intval(MYSQL_MINOR_VERSION)>=3 } } if (!isset($sot_ready)){ - $result=mysql_query("show table status from $db"); + $result=mysql_query("show table status from `$db`"); if ($result!=false && mysql_num_rows($result)>0){ while ($sts_tmp=mysql_fetch_array($result)){ $tbl_cache[]=$sts_tmp; @@ -270,7 +270,7 @@ if($cfgBookmark['db'] && $cfgBookmark['table'])
  • -&zero_rows=&goto=main.php3&reload=true"> +&zero_rows=&goto=main.php3&reload=true"> 20){ - $result=mysql_query("show create table $db.$table"); + $result=mysql_query("show create table `$db`.$table"); if ($result!=false && mysql_num_rows($result)>0){ $tmpres=mysql_fetch_array($result); $tmp=$tmpres[1]; @@ -524,7 +524,7 @@ function get_table_def($db, $table, $crlf) $schema_create .= "CREATE TABLE $table ($crlf"; - $result = mysql_query("SHOW FIELDS FROM $db.$table") or mysql_die(); + $result = mysql_query("SHOW FIELDS FROM `$db`.$table") or mysql_die(); while($row = mysql_fetch_array($result)) { $schema_create .= " $row[Field] $row[Type]"; @@ -538,7 +538,7 @@ function get_table_def($db, $table, $crlf) $schema_create .= ",$crlf"; } $schema_create = ereg_replace(",".$crlf."$", "", $schema_create); - $result = mysql_query("SHOW KEYS FROM $db.$table") or mysql_die(); + $result = mysql_query("SHOW KEYS FROM `$db`.$table") or mysql_die(); while($row = mysql_fetch_array($result)) { $kname=$row['Key_name']; @@ -587,7 +587,7 @@ function get_table_def($db, $table, $crlf) // $handler must accept one parameter ($sql_insert); function get_table_content($db, $table, $handler) { - $result = mysql_query("SELECT * FROM $db.$table") or mysql_die(); + $result = mysql_query("SELECT * FROM `$db`.$table") or mysql_die(); $i = 0; while($row = mysql_fetch_row($result)) { @@ -643,7 +643,7 @@ function get_table_content($db, $table, $handler) function count_records ($db,$table) { - $result = mysql_query("select count(*) as num from $db.$table"); + $result = mysql_query("select count(*) as num from `$db`.$table"); $num = mysql_result($result,0,"num"); echo $num; } @@ -654,7 +654,7 @@ function count_records ($db,$table) // $handler must accept one parameter ($sql_insert); function get_table_csv($db, $table, $sep, $handler) { - $result = mysql_query("SELECT * FROM $db.$table") or mysql_die(); + $result = mysql_query("SELECT * FROM `$db`.$table") or mysql_die(); $i = 0; while($row = mysql_fetch_row($result)) {