function step_2($connect, $select, $chat, $fpconfig)
{
    $configtpl = "../conf/config.php-tpl";
    $fpconfigtpl = fopen($configtpl, "r");
    $inhalt = fread($fpconfigtpl, filesize($configtpl));
    foreach ($chat as $key => $value) {
        $inhalt = str_replace("%{$key}%", addslashes($value), $inhalt);
    }
    fwrite($fpconfig, $inhalt, strlen($inhalt));
    echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\" align=\"center\">\n" . "<tr bgcolor=\"#007ABE\"><td style=\"font-size:15px; text-align:center;color:White;\"><b>Konfigurationsdatei</b></td></tr>\n" . "<tr><td > Im Verzeichnis conf wurde folgende Konfigurationsdatei angelegt: <br>\n";
    $config = "../conf/config.php";
    if (!file_exists($config)) {
        echo "<span style=\"color:red\">Anlegen der <b>config.php</b> misslungen</span></td></tr>\n";
    } else {
        echo "<b>config.php</b></td></tr>\n";
    }
    $mysqldatei = "../dok/mysql.def";
    $mysqlfp = fopen($mysqldatei, "r");
    $mysqlinhalt = fread($mysqlfp, filesize($mysqldatei));
    $mysqlarray = explode(';', $mysqlinhalt);
    foreach ($mysqlarray as $key => $value) {
        mysql_query($value);
    }
    echo "<tr><td colspan=\"2\"><br><br></td></tr>\n" . "<tr bgcolor=\"#007ABE\"><td style=\"font-size:15px; text-align:center;color:White;\"><b>Datenbank</b></td></tr>\n" . "<tr><td>In der Datenbank " . $chat['dbase'] . " (Datenbankuser: "******") wurden folgende Tabellen " . "angelegt: <br>\n";
    $tables = mysql_listtables($chat['dbase']);
    for ($i = 0; $i < mysql_num_rows($tables); $i++) {
        $table = mysql_tablename($tables, $i);
        echo "<b>" . $table . "</b>, \n";
    }
    echo "</td></tr>" . "<tr><td colspan=\"2\"><br><br></td></tr>\n";
    echo "<tr><td> Mit <b>Nickname admin und Passwort admin</b> können Sie sich beim ersten Mal anmelden!<br>\n" . "<a href=\"../index.php\">zum Chat</a></tr></td></table>\n";
}
Esempio n. 2
0
 function GetTables()
 {
     $xmlOutput = "";
     $result = mysql_list_tables($this->database, $this->connectionId);
     if ($result) {
         $xmlOutput = "<RESULTSET><FIELDS>";
         // Columns are referenced by index, so Schema and
         // Catalog must be specified even though they are not supported
         $xmlOutput .= "<FIELD><NAME>TABLE_CATALOG</NAME></FIELD>";
         // column 0 (zero-based)
         $xmlOutput .= "<FIELD><NAME>TABLE_SCHEMA</NAME></FIELD>";
         // column 1
         $xmlOutput .= "<FIELD><NAME>TABLE_NAME</NAME></FIELD>";
         // column 2
         $xmlOutput .= "</FIELDS><ROWS>";
         $tableCount = mysql_num_rows($result);
         for ($i = 0; $i < $tableCount; $i++) {
             $xmlOutput .= "<ROW><VALUE/><VALUE/><VALUE>";
             $xmlOutput .= mysql_tablename($result, $i);
             $xmlOutput .= "</VALUE></ROW>";
         }
         $xmlOutput .= "</ROWS></RESULTSET>";
     }
     return $xmlOutput;
 }
function makedump($table_select, $what, $db, $crlf = "\n")
{
    global $dump_buffer, $tmp_buffer;
    $tables = mysql_list_tables($db);
    $num_tables = mysql_numrows($tables);
    $dump_buffer = '';
    $tmp_buffer = '';
    $i = 0;
    while ($i < $num_tables) {
        $table = mysql_tablename($tables, $i);
        if (!isset($table_select[$table])) {
            $i++;
            continue;
        }
        if ($what != 'dataonly') {
            $dump_buffer .= PMA_getTableDef($db, $table, $crlf) . ';' . $crlf . $crlf;
        }
        if ($what == 'data' || $what == 'dataonly') {
            $tmp_buffer = '';
            PMA_getTableContent($db, $table, 0, 0, 'PMA_myHandler', $crlf);
            $dump_buffer .= $tmp_buffer . $crlf;
        }
        $i++;
    }
    return $dump_buffer;
}
Esempio n. 4
0
 function list_tables()
 {
     $res = mysql_list_tables($this->db['dbName']);
     for ($i = 0; $i < $this->num_rows($res); $i++) {
         $fields[$i] = mysql_tablename($res, $i);
     }
     return $fields;
 }
Esempio n. 5
0
 function _getTableList($dbName)
 {
     $tableList = array();
     $result = mysql_list_tables($dbName, $this->_mysql_link_id);
     for ($i = 0; $i < mysql_num_rows($result); $i++) {
         array_push($tableList, mysql_tablename($result, $i));
     }
     mysql_free_result($result);
     return $tableList;
 }
 public function listTables()
 {
     $tableNames = array();
     if ($this->_link) {
         $result = mysql_query('SHOW TABLES');
         for ($i = 0; $i < mysql_num_rows($result); $i++) {
             $tableNames[$i] = mysql_tablename($result, $i);
         }
     }
     return $tableNames;
 }
Esempio n. 7
0
 function TableExists($tablename, $db)
 {
     $result = mysql_list_tables($db);
     $rcount = mysql_num_rows($result);
     for ($i = 0; $i < $rcount; $i++) {
         if (mysql_tablename($result, $i) == $tablename) {
             return true;
         }
     }
     return false;
 }
Esempio n. 8
0
 function getTables()
 {
     global $MYSQL_SERVER, $MYSQL_USERNAME, $MYSQL_PASSWORD, $MYSQL_DBNAME;
     $result = mysql_list_tables($MYSQL_DBNAME);
     $num_rows = mysql_num_rows($result);
     for ($i = 0; $i < $num_rows; $i++) {
         //here
         $tables[$i] = mysql_tablename($result, $i);
     }
     return $tables;
 }
Esempio n. 9
0
 function &MetaDatabases()
 {
     $qid = mysql_list_dbs($this->_connectionID);
     $arr = array();
     $i = 0;
     $max = mysql_num_rows($qid);
     while ($i < $max) {
         $arr[] = mysql_tablename($qid, $i);
         $i += 1;
     }
     return $arr;
 }
Esempio n. 10
0
 function ListTables($db, $cnx)
 {
     $list = array();
     $_res = mysql_list_tables($db, $cnx);
     $i = 0;
     $ntables = $_res ? @mysql_num_rows($_res) : 0;
     while ($i < $ntables) {
         array_push($list, mysql_tablename($_res, $i));
         $i++;
     }
     return $list;
 }
Esempio n. 11
0
 function dump()
 {
     /**
      * Increase time limit for script execution and initializes some variables
      */
     set_time_limit(0);
     $hostname = "";
     if (isset($_SERVER["HTTP_HOST"])) {
         $hostname = $_SERVER["HTTP_HOST"];
     }
     ### IE need specific headers
     #if(getBrowserAgent() == 'IE') {
     #    #header('Content-Disposition: inline; filename="' . $filename . '.' . $ext . '"');
     #    header('Expires: 0');
     #    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     #    header('Pragma: public');
     #}
     ### Builds the dump
     $tables = mysql_list_tables($this->db_name);
     if (!($num_tables = mysql_numrows($tables))) {
         echo "mysql-error:<pre>" . mysql_error() . "</pre>";
         trigger_error("no tables found", E_USER_ERROR);
         exit(0);
     }
     $dump_buffer = "# slim phpMyAdmin MySQL-Dump\n";
     for ($i = 0; $i < $num_tables; $i++) {
         $table_name = mysql_tablename($tables, $i);
         $dump_buffer .= $this->crlf . '#' . $this->crlf . '#' . $this->backquote($table_name) . $this->crlf . '#' . $this->crlf . $this->crlf . $this->getTableDef($table_name) . ';' . $this->crlf . $this->getTableContentFast($table_name);
     }
     $dump_buffer .= $this->crlf;
     ### Displays the dump as gzip-file
     if (function_exists('gzencode')) {
         $filename = $hostname . "_" . $this->db_name . '_' . date("Y-m-d_H:i") . '.gzip';
         $mime_type = 'application/x-gzip';
         ### Send headers
         header('Content-Type: ' . $mime_type);
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Expires: 0');
         header('Pragma: no-cache');
         echo gzencode($dump_buffer);
         # without the optional parameter level because it bugs
     } else {
         $filename = $hostname . "_" . $this->db_name . '_' . date("Y-m-d_H:i") . '.sql';
         ### Send headers
         header('Content-Type: ' . $mime_type);
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header('Expires: 0');
         header('Pragma: no-cache');
         #trigger_error("gzencode() not defined. Saving backup failed", E_USER_ERROR);
         echo "<pre>" . $dump_buffer . "</pre>";
     }
 }
Esempio n. 12
0
function TableExists($tablename, $db)
{
    // Get a list of tables contained within the database.
    $result = mysql_list_tables($db);
    $rcount = mysql_num_rows($result);
    // Check each in list for a match.
    for ($i = 0; $i < $rcount; $i++) {
        if (mysql_tablename($result, $i) == $tablename) {
            return true;
        }
    }
    return false;
}
Esempio n. 13
0
function isTable($s)
{
    global $sSqlDB;
    if ($sSqlDB != '') {
        $dTables = mysql_list_tables($sSqlDB);
        for ($i = 0; $i < mysql_numrows($dTables); $i++) {
            if (mysql_tablename($dTables, $i) == $s) {
                return true;
            }
        }
    }
    return false;
}
Esempio n. 14
0
/**
*  checkTableExist = Check whether the table exists, 
*  param $must_table = the table to be check if it exists
*  param $default_table = default table 
*  return = $must_table if exist, otherwise $default_table
*/
function checkTableExist($must_table, $default_table)
{
    global $dbname, $link;
    $all_table = mysql_list_tables($dbname, $link);
    $i = 0;
    while ($i < mysql_num_rows($all_table)) {
        if ($must_table == mysql_tablename($all_table, $i)) {
            $default_table = $must_table;
            break;
        }
        $i++;
    }
    return $default_table;
}
 /**
  * Dump data and structure from MySQL database
  *
  * @param string $database
  * @return string
  */
 function dumpDatabase($database, $link)
 {
     // Connect to database
     $db = mysql_select_db($database, $link);
     if (!empty($db)) {
         // Get all table names from database
         $c = 0;
         $result = mysql_list_tables($database, $link);
         for ($x = 0; $x < mysql_num_rows($result); $x++) {
             $table = mysql_tablename($result, $x);
             if (!empty($table)) {
                 $arr_tables[$c] = mysql_tablename($result, $x);
                 $c++;
             }
         }
         // List tables
         $dump = '';
         for ($y = 0; $y < count($arr_tables); $y++) {
             // DB Table name
             $table = $arr_tables[$y];
             // Dump data
             unset($data);
             $result = mysql_query("SELECT * FROM `{$table}`", $link);
             $num_rows = mysql_num_rows($result);
             $num_fields = mysql_num_fields($result);
             for ($i = 0; $i < $num_rows; $i++) {
                 $row = mysql_fetch_object($result);
                 $data .= "INSERT INTO `{$table}` (";
                 // Field names
                 for ($x = 0; $x < $num_fields; $x++) {
                     $field_name = mysql_field_name($result, $x);
                     $data .= "`{$field_name}`";
                     $data .= $x < $num_fields - 1 ? ", " : false;
                 }
                 $data .= ") VALUES (";
                 // Values
                 for ($x = 0; $x < $num_fields; $x++) {
                     $field_name = mysql_field_name($result, $x);
                     $data .= "'" . str_replace('\\"', '"', mysql_escape_string($row->{$field_name})) . "'";
                     $data .= $x < $num_fields - 1 ? ", " : false;
                 }
                 $data .= ");\n";
             }
             $data .= "\n";
             $dump .= $structure . $data;
             $dump .= "-- --------------------------------------------------------\n\n";
         }
         return $dump;
     }
 }
Esempio n. 16
0
 private function delarray($array)
 {
     //处理传入进来的数组
     foreach ($array as $tables) {
         if ($tables == '*') {
             //所有的表(获得表名时不能按常规方式来组成一个数组)
             $newtables = mysql_list_tables($this->dbName, $this->mysql_link);
             $tableList = array();
             for ($i = 0; $i < mysql_numrows($newtables); $i++) {
                 array_push($tableList, mysql_tablename($newtables, $i));
             }
             $tableList = $tableList;
         } else {
             $tableList = $array;
             break;
         }
     }
     return $tableList;
 }
Esempio n. 17
0
function ddtables($dbname)
{
    global $sel_table;
    if (!empty($dbname)) {
        $result = mysql_list_tables($dbname);
        $i = 0;
        echo "\nTables: <select name=\"sel_table\">\n";
        echo "<option value=\"\">select table ....</option>\n";
        while ($i < mysql_num_rows($result)) {
            $tb_names[$i] = mysql_tablename($result, $i);
            if ($tb_names[$i] == "{$sel_table}") {
                echo "<option value=\"{$tb_names[$i]}\" selected>{$tb_names[$i]}</option>\n";
            } else {
                echo "<option value=\"{$tb_names[$i]}\">{$tb_names[$i]}</option>\n";
            }
            $i++;
        }
        echo "</select>";
    }
}
Esempio n. 18
0
 function mysqlTable($action)
 {
     global $pmb_set_time_limit, $dbh;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result = array();
         if ($action) {
             @set_time_limit($pmb_set_time_limit);
             $db = DATA_BASE;
             $tables = mysql_list_tables($db);
             $num_tables = @mysql_num_rows($tables);
             $i = 0;
             while ($i < $num_tables) {
                 $table[$i] = mysql_tablename($tables, $i);
                 $i++;
             }
             while (list($cle, $valeur) = each($table)) {
                 $requete = $action . " TABLE " . $valeur . " ";
                 $res = @mysql_query($requete, $dbh);
                 $nbr_lignes = @mysql_num_rows($res);
                 if ($nbr_lignes) {
                     for ($i = 0; $i < $nbr_lignes; $i++) {
                         $row = mysql_fetch_row($res);
                         $tab = array();
                         foreach ($row as $dummykey => $col) {
                             if (!$col) {
                                 $col = "&nbsp;";
                             }
                             $tab[$dummykey] = $col;
                         }
                         $result[] = $tab;
                     }
                 }
             }
         }
         return $result;
     } else {
         return array();
     }
 }
Esempio n. 19
0
	function Savedb()
	{		
		// init the var
		$copyr = null;
		$dbname = null;
		$newfile = null;
		
		$tables = mysql_list_tables($this->dbname,$this->conn);
		$num_tables = @mysql_num_rows($tables);
		$i = 0;
		while($i < $num_tables) 
		{ 
		      $table = mysql_tablename($tables, $i);
		      $table = ltrim($table);
		      $newfile .= $this->get_def($dbname,$table);
		      $newfile .= "\n\n";
		      $newfile .= $this->get_content($dbname,$table);
		      $newfile .= "\n\n";
		      $i++;
		}	
		
		echo $newfile;
	}
Esempio n. 20
0
function ImportCreateTable()
{
    global $sql, $lang, $db, $config;
    $tbl = array();
    $tabellen = mysql_list_tables($db, $config['dbconnection']);
    $num_tables = mysql_num_rows($tabellen);
    for ($i = 0; $i < $num_tables; $i++) {
        $tbl[] = strtolower(mysql_tablename($tabellen, $i));
    }
    $i = 0;
    $sql['import']['table'] = $sql['import']['table'] . $i;
    while (in_array($sql['import']['table'], $tbl)) {
        $sql['import']['table'] = substr($sql['import']['table'], 0, strlen($sql['import']['table']) - 1) . ++$i;
    }
    $create = "CREATE TABLE `" . $sql['import']['table'] . "` (" . ($sql['import']['createindex'] == 1 ? '`import_id` int(11) unsigned NOT NULL auto_increment, ' : '');
    if ($sql['import']['namefirstline']) {
        for ($i = 0; $i < count($sql['import']['first_zeile']); $i++) {
            $create .= '`' . $sql['import']['first_zeile'][$i] . '` VARCHAR(250) NOT NULL, ';
        }
    } else {
        for ($i = 0; $i < count($sql['import']['first_zeile']); $i++) {
            $create .= '`FIELD_' . $i . '` VARCHAR(250) NOT NULL, ';
        }
    }
    if ($sql['import']['createindex'] == 1) {
        $create .= 'PRIMARY KEY (`import_id`) ';
    } else {
        $create = substr($create, 0, strlen($create) - 2);
    }
    $create .= ') ' . (MSD_NEW_VERSION ? 'ENGINE' : 'TYPE') . "=MyISAM COMMENT='imported at " . date("l dS of F Y H:i:s A") . "'";
    $res = mysql_query($create, $config['dbconnection']) || die(SQLError($create, mysql_error()));
    return 1;
}
Esempio n. 21
0
 /**
  * Test mysql_tablename
  *
  * @return boolean
  */
 public function MySQL_Tablename_Test()
 {
     // Connect
     list($mysql, $ourDb) = $this->_getConnection();
     $dbs1 = mysql_list_tables(TEST_DB);
     $dbs2 = $this->_object->mysql_list_tables(TEST_DB);
     $list1 = array();
     $list2 = array();
     $i = 0;
     $cnt = mysql_num_rows($dbs1);
     while ($i < $cnt) {
         $list1[] = mysql_tablename($dbs1, $i);
         $i++;
     }
     $i = 0;
     $cnt = $this->_object->mysql_num_rows($dbs2);
     while ($i < $cnt) {
         $list2[] = $this->_object->mysql_tablename($dbs2, $i);
         $i++;
     }
     return $list1 === $list2;
 }
Esempio n. 22
0
     }
 }
 echo "{$text}\n<table height=200 width=100%><tr><td bgcolor=green width=10%>";
 $db_list = mysql_list_dbs($connect);
 echo "<select name='db' multiple size=30>\n";
 while ($row = mysql_fetch_object($db_list)) {
     $db1 = $row->Database;
     echo "<option value='{$db1}' " . ($db1 === $_POST['db'] ? 'selected' : '') . ">{$db1}</option>\n";
 }
 echo "</select></td><td bgcolor=#CBC3B6>\n";
 if (!empty($_POST['db'])) {
     $tb_list = mysql_list_tables($_POST['db']);
     echo "<select name='table_sel' multiple size=30>";
     for ($i = 0; $i < mysql_num_rows($tb_list); $i++) {
         $n = mysql_fetch_array(mysql_query('select count(*) from ' . mysql_tablename($tb_list, $i)));
         echo "<option value='" . mysql_tablename($tb_list, $i) . "'" . ($tr = isset($_POST['table_sel']) && $_POST['table_sel'] === mysql_tablename($tb_list, $i) ? 'selected' : '') . ">" . mysql_tablename($tb_list, $i) . '(' . $n[0] . ")</option>";
     }
     echo "</select></td><td width=100%>\n<table  width=100% height=100% bgcolor='#E3FFF2'><tr><td height=20 bgcolor=#dfdfdf width=100%><nobr>\n";
     if (isset($_POST['table_sel'])) {
         $c = array('Browse', 'SQL', 'Insert', 'Export');
         $i = -1;
         while ($i++ < 3) {
             echo "<input type=radio Name='go' value='" . $i . "'>" . $c[$i];
         }
     }
     echo "&nbsp;&nbsp;<b>" . (isset($_POST['table_sel']) ? $_POST['table_sel'] : null) . "</b></nobr></td></tr><tr width=100%><td width=100%>\n";
 }
 if (isset($_POST['push']) && isset($_POST['querysql']) && preg_match('/^\\s*select /i', $_POST['querysql'])) {
     $_POST['go'] = 0;
 } elseif (isset($_POST['push'])) {
     $_POST['go'] = 1;
Esempio n. 23
0
 /**
  * PHP mysqldump fallback functions, exports the database to a .sql file
  *
  * @access public
  */
 public function mysqldump_fallback()
 {
     $this->errors_to_warnings($this->get_mysqldump_method());
     $this->mysqldump_method = 'mysqldump_fallback';
     $this->do_action('hmbkp_mysqldump_started');
     $this->db = @mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD);
     if (!$this->db) {
         $this->db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
     }
     if (!$this->db) {
         return;
     }
     mysql_select_db(DB_NAME, $this->db);
     if (function_exists('mysql_set_charset')) {
         mysql_set_charset(DB_CHARSET, $this->db);
     }
     // Begin new backup of MySql
     $tables = mysql_query('SHOW TABLES');
     $sql_file = "# WordPress : " . get_bloginfo('url') . " MySQL database backup\n";
     $sql_file .= "#\n";
     $sql_file .= "# Generated: " . date('l j. F Y H:i T') . "\n";
     $sql_file .= "# Hostname: " . DB_HOST . "\n";
     $sql_file .= "# Database: " . $this->sql_backquote(DB_NAME) . "\n";
     $sql_file .= "# --------------------------------------------------------\n";
     for ($i = 0; $i < mysql_num_rows($tables); $i++) {
         $curr_table = mysql_tablename($tables, $i);
         // Create the SQL statements
         $sql_file .= "# --------------------------------------------------------\n";
         $sql_file .= "# Table: " . $this->sql_backquote($curr_table) . "\n";
         $sql_file .= "# --------------------------------------------------------\n";
         $this->make_sql($sql_file, $curr_table);
     }
 }
Esempio n. 24
0
 * Prepares the form
 */
$tbl_result = mysql_list_tables($db);
$tbl_result_cnt = mysql_num_rows($tbl_result);
$i = 0;
$k = 0;
// The tables list sent by a previously submitted form
if (!empty($TableList)) {
    for ($x = 0; $x < sizeof($TableList); $x++) {
        $tbl_names[$TableList[$x]] = ' selected="selected"';
    }
}
// end if
// The tables list gets from MySQL
while ($i < $tbl_result_cnt) {
    $tbl = mysql_tablename($tbl_result, $i);
    $fld_results = mysql_list_fields($db, $tbl);
    $fld_results_cnt = mysql_num_fields($fld_results);
    $j = 0;
    if (empty($tbl_names[$tbl]) && !empty($TableList)) {
        $tbl_names[$tbl] = '';
    } else {
        $tbl_names[$tbl] = ' selected="selected"';
    }
    //  end if
    // The fields list per selected tables
    if ($tbl_names[$tbl] == ' selected="selected"') {
        $fld[$k++] = PMA_backquote($tbl) . '.*';
        while ($j < $fld_results_cnt) {
            $fld[$k] = mysql_field_name($fld_results, $j);
            $fld[$k] = PMA_backquote($tbl) . '.' . PMA_backquote($fld[$k]);
Esempio n. 25
0
		<input type="submit" name="submit" value="Submit">
		<input type="submit" name="cancel" value="Cancel">
		</form>' . PHP_EOL;
    } else {
        if (!isset($tb)) {
            echo '<h1>Please select a table from database: ' . htmlspecialchars($db) . '</h1>
		<form action="' . htmlspecialchars($self) . '" method="POST">
		<input type="hidden" name="hn" value="' . htmlspecialchars($hn) . '">
		<input type="hidden" name="un" value="' . htmlspecialchars($un) . '">
		<input type="hidden" name="pw" value="' . htmlspecialchars($pw) . '">
		<input type="hidden" name="db" value="' . htmlspecialchars($db) . '">
		<table border="1" cellpadding="1" cellspacing="1" summary="Table selection">' . PHP_EOL;
            $tbs = @mysql_list_tables($db, $dbl);
            $num_tbs = @mysql_num_rows($tbs);
            for ($j = 0; $j < $num_tbs; $j++) {
                $tb = @mysql_tablename($tbs, $j);
                $tb = htmlspecialchars($tb);
                $checked = $j == 0 ? ' checked' : '';
                echo '<tr><td><input' . $checked . ' type="radio" name="tb" value="' . $tb . '"></td><td>' . $tb . '</td></tr>' . PHP_EOL;
            }
            echo '</table><br>
		<input type="submit" name="submit" value="Submit">
		<input type="submit" name="cancel" value="Cancel">
		</form>' . PHP_EOL;
        } else {
            if (!isset($id)) {
                echo '  <h1>Please select an identifier from table: ' . htmlspecialchars($tb) . '</h1>
		<p>
		This field will be used in change, view, copy and delete operations.<br>
		The field should be numeric and must uniquely identify a record.
		</p>
Esempio n. 26
0
function db_tablename($result, $i)
{
    return mysql_tablename($result, $i);
}
Esempio n. 27
0
<?php

include "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysql_tablename())) {
    printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
if (null !== ($tmp = @mysql_tablename($link))) {
    printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require 'table.inc';
if (!($res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 2", $link))) {
    printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
if (NULL !== ($tmp = mysql_tablename($res))) {
    printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
if (false !== ($tmp = mysql_tablename($res, -1))) {
    printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
}
var_dump(mysql_tablename($res, 0));
if (false !== ($tmp = mysql_tablename($res, 2))) {
    printf("[00%d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
}
mysql_free_result($res);
var_dump(mysql_tablename($res, 0));
mysql_close($link);
print "done!";
Esempio n. 28
0
 /**
  * Test mysql_tablename
  *
  * @return boolean
  */
 public function MySQL_Tablename_Test()
 {
     // Connect
     $this->_getConnection();
     $dbs1 = mysql_list_tables(TEST_DB);
     $list1 = array();
     $i = 0;
     $cnt = mysql_num_rows($dbs1);
     while ($i < $cnt) {
         $list1[] = mysql_tablename($dbs1, $i);
         $i++;
     }
     return $list1[0] === 'unit_sql_table_1';
 }
Esempio n. 29
0
<?php 
$priviledge = '00';
include 'allow_to_show.inc';
?>
<form method="POST" action="php.php">
  	<p><b>The following database found in MySQL server</b>&nbsp;&nbsp;&nbsp;
    <select size="1" name="dblist">
    <?php 
//list database
$dbcont = "invalid";
include "connet_root.inc";
$result = mysql_list_dbs();
$i = 0;
while ($i < mysql_num_rows($result)) {
    $tb_names[$i] = mysql_tablename($result, $i);
    if ($i == 0) {
        echo '<option selected>';
        echo $tb_names[$i];
        echo '</option>';
    } else {
        echo '<option>';
        echo $tb_names[$i];
        echo '</option>';
    }
    $i++;
}
?>
	
	&nbsp;
	</select>&nbsp;&nbsp;&nbsp; <input type="submit" value="Change Database" name="chdb"></p>
Esempio n. 30
0
    if (!isset($sot_ready)) {
        $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
        $result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
        if ($result != FALSE && mysql_num_rows($result) > 0) {
            while ($sts_tmp = mysql_fetch_array($result)) {
                $tables[] = $sts_tmp;
            }
            mysql_free_result($result);
        }
    }
    $num_tables = isset($tables) ? count($tables) : 0;
} else {
    $result = mysql_list_tables($db);
    $num_tables = @mysql_numrows($result);
    for ($i = 0; $i < $num_tables; $i++) {
        $tables[] = mysql_tablename($result, $i);
    }
    mysql_free_result($result);
}
/**
 * If there is at least one table, displays the printer friendly view, else
 * an error message
 */
// 1. No table
if ($num_tables == 0) {
    echo $strNoTablesFound;
} else {
    if (PMA_MYSQL_INT_VERSION >= 32303) {
        ?>

<!-- The tables list -->