本文整理汇总了PHP中mysql_tablename函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_tablename函数的具体用法?PHP mysql_tablename怎么用?PHP mysql_tablename使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_tablename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: step_2
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: " . $chat['user'] . ") 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";
}
示例2: GetTables
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;
}
示例3: makedump
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;
}
示例4: list_tables
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;
}
示例5: _getTableList
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;
}
示例6: listTables
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;
}
示例7: TableExists
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;
}
示例8: getTables
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;
}
示例9: mysql_list_dbs
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;
}
示例10: ListTables
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;
}
示例11: dump
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>";
}
}
示例12: TableExists
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;
}
示例13: isTable
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;
}
示例14: checkTableExist
/**
* 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;
}
示例15: dumpDatabase
/**
* 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;
}
}