当前位置: 首页>>代码示例>>PHP>>正文


PHP MySQL::RowArray方法代码示例

本文整理汇总了PHP中MySQL::RowArray方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::RowArray方法的具体用法?PHP MySQL::RowArray怎么用?PHP MySQL::RowArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MySQL的用法示例。


在下文中一共展示了MySQL::RowArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_expense

 /**
  * returns single expense entry as array
  *
  * @param integer $id ID of entry in table exp
  * @global array $kga kimai-global-array
  * @return array
  * @author sl
  */
 public function get_expense($id)
 {
     $id = MySQL::SQLValue($id, MySQL::SQLVALUE_NUMBER);
     $table = $this->getExpenseTable();
     $projectTable = $this->getProjectTable();
     $customerTable = $this->getCustomerTable();
     $query = "SELECT * FROM {$table}\n\t              LEFT JOIN {$projectTable} USING(projectID)\n\t              LEFT JOIN {$customerTable} USING(customerID)\n\t              WHERE {$table}.expenseID = {$id} LIMIT 1;";
     $this->conn->Query($query);
     return $this->conn->RowArray(0, MYSQLI_ASSOC);
 }
开发者ID:kimai,项目名称:kimai,代码行数:18,代码来源:Database.php

示例2: rowExists

 /**
  * checks if a given db row based on the $idColumn & $id exists
  * @param string $table
  * @param array $filter
  * @return bool
  */
 protected function rowExists($table, array $filter)
 {
     $select = $this->conn->SelectRows($table, $filter);
     if (!$select) {
         $this->logLastError('rowExists');
         return false;
     }
     return (bool) $this->conn->RowArray(0, MYSQLI_ASSOC);
 }
开发者ID:kimai,项目名称:kimai,代码行数:15,代码来源:Mysql.php

示例3: dumpTableData

 function dumpTableData($table)
 {
     $conn = new MySQL(true, DBNAME, DBHOST, DBUSER, DBPASS, "", true);
     $strTables = "SELECT * FROM `{$table}`";
     $conn->QueryArray($strTables);
     $cntTables = $conn->RowCount();
     if ($cntTables) {
         $num_fields = $conn->GetColumnCount($table);
         $this->output .= "\n\n";
         $this->output .= "-- \n";
         $this->output .= "-- Dumping data for table `{$table}` \n";
         $this->output .= "-- \n\n";
         $fields = '';
         $field_type = array();
         $i = 0;
         while ($i < $num_fields) {
             if (!$fields) {
                 $fields = "`" . $conn->GetColumnName($i, $table) . "`";
             } else {
                 $fields .= ", " . "`" . $conn->GetColumnName($i, $table) . "`";
             }
             //                array_push($field_type, $conn->GetColumnDataType($i, $table));
             $i++;
         }
         $conn->MoveFirst();
         while (!$conn->EndOfSeek()) {
             $rsTable = $conn->RowArray();
             $this->output .= "INSERT INTO `{$table}` ({$fields}) VALUES (";
             for ($i = 0; $i < $num_fields; $i++) {
                 if (is_null($rsTable[$i])) {
                     $this->output .= "null";
                 } else {
                     switch ($field_type[$i]) {
                         case 'int':
                             $this->output .= $rsTable[$i];
                             break;
                         case 'string':
                         case 'blob':
                         default:
                             $this->output .= "'" . addslashes($rsTable[$i]) . "'";
                             break;
                     }
                 }
                 if ($i < $num_fields - 1) {
                     $this->output .= ", ";
                 }
             }
             $this->output .= ");\n";
         }
     }
     $this->output .= "\n";
 }
开发者ID:aliihaidar,项目名称:pso,代码行数:52,代码来源:backup.class.php

示例4: die

    die('Error contacting database!' . $sql);
}
$db->TruncateTable("import_tempstock");
//destroy table data
$sql = "CREATE TABLE IF NOT EXISTS `import_categories` (\n  `uid` int(11) NOT NULL AUTO_INCREMENT,\n  `code` varchar(16) NOT NULL,\n  `hkcategory` varchar(50) NULL,\n  `wwwcategory` varchar(254) NULL,\n  `hksupplier` varchar(50) NULL,\n  `wwwsupplier` varchar(254) NULL,\n  PRIMARY KEY (`uid`),\n  KEY `code` (`code`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ";
$results = $db->Query($sql);
if (!$results) {
    die('Error contacting database!' . $sql);
}
// this table is not to be emptied, as it contains a chart of SUBSTITUTE names of categories or suppliers
//
//
$now = time();
$results = $db->Query("SHOW TABLE STATUS WHERE name =  'import_categories'");
// read the timestamp to the table to tell us when it was last updated
$timeres = $db->RowArray();
//print_r($timeres);
$dbtime = $timeres['Comment'];
if ($now > $dbtime + 3600) {
    //last updated an hour ago
    // process the categories first!
    $dbr = new dbf_class('datastore/REFCODES.DBF');
    $num_rec = $dbr->dbf_num_rec;
    $field_num = $dbr->dbf_num_field;
    for ($i = 0; $i < $num_rec; $i++) {
        unset($code);
        //empty our temp array for each iteration
        $row = $dbr->getRow($i);
        switch ($row[0]) {
            case 'Q':
                //category
开发者ID:onyxnz,项目名称:quartzpos,代码行数:31,代码来源:importread.php

示例5: elseif

    if ($lang == 'de') {
        echo 'Datenbank hat Zugriff verweigert. Gehen Sie bitte zurück.<br /><button onclick="step_back(); return false;">Zurück</button>';
    } else {
        echo 'The database refused access. Please go back.<br /><button onclick="step_back(); return false;">Back</button>';
    }
    return;
}
// ====================================================================================================================
// if there is any error we have to show this page again, otherwise redirect to the next step
$errors = false;
ob_start();
// get permissions
$showDatabasesAllowed = false;
$createDatabaseAllowed = false;
$result = $con->Query('SHOW GRANTS');
while ($row = $con->RowArray(null, MYSQLI_NUM)) {
    if (strpos($row[0], 'SHOW DATABASES') !== false) {
        $showDatabasesAllowed = true;
    } elseif (strpos($row[0], 'CREATE,') !== false) {
        $createDatabaseAllowed = true;
    } elseif (strpos($row[0], 'ALL PRIVILEGES') !== false) {
        $showDatabasesAllowed = true;
        $createDatabaseAllowed = true;
    }
}
$useDatabases = array();
if ($showDatabasesAllowed) {
    try {
        $con->MoveFirst();
        $result = $con->Query('SHOW DATABASES');
        while ($row = $con->RowArray(-2, MYSQLI_NUM)) {
开发者ID:kimai,项目名称:kimai,代码行数:31,代码来源:60_db_select_mysql.php

示例6:

for ($index = 0; $index < $db->RowCount(); $index++) {
    $row = $db->Row($index);
    echo "Index " . $index . ": ";
    echo $row->Color . " and " . $row->Age . "<br />\n";
}
echo "<hr />\n";
// ---------------------------------------------------------
// Now let's just show all the data as an HTML table
// This method is great for testing or displaying simple results
echo $db->GetHTML(false);
echo "<hr />\n";
// ---------------------------------------------------------
// Now let's grab the first row of data as an associative array
// The paramters are completely optional. Every time you grab a
// row, the cursor is automatically moved to the next row. Here,
// we will specify the the first row (0) to reset our position.
// We will also specify what type of array we want returned.
$array = $db->RowArray(0, MYSQL_ASSOC);
// Display the array
echo "<pre>\n";
print_r($array);
echo "</pre>\n";
echo "<hr />\n";
// ---------------------------------------------------------
// And now show the individual columns in the array
echo $array[Color] . " and " . $array[Age] . "<br />\n";
// Grab the next row as an array. Notice how we didn't specify
// a row (0) like above? It's completely optional.
$array = $db->RowArray();
echo $array[Color] . " and " . $array[Age] . "<br />\n";
// There are so many different ways to use the Ultimate MySQL class!
开发者ID:kimai,项目名称:kimai,代码行数:31,代码来源:example.select.php


注:本文中的MySQL::RowArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。