PHP.mk документација

odbc_result_all

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

function.odbc-result-all.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека function.odbc-result-all.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
odbc_result_all

Референца за `function.odbc-result-all.php` со подобрена типографија и навигација.

function.odbc-result-all.php

odbc_result_all

(PHP 4, PHP 5, PHP 7, PHP 8)

odbc_result_allПрикажи резултат како HTML табела

Ги ескејпува специјалните знаци во стринг за употреба во SQL изјава

Оваа функција е DEPRECATED Парсирај време/датум генериран со

= NULL

Прикажува сите редови од резултат објект произведен од odbc_exec(). Резултатот се прикажува во формат на HTML табела. Податоците се not escaped.

Оваа функција не треба да се користи во продукциски средини; таа е наменета само за развојни цели, за брзо прикажување на сет на резултати.

Параметри

statement

ODBC објектот за резултат.

format

Дополнително форматирање на целата табела.

Вратени вредности

Враќа број на редови во резултатот или false при грешка.

Дневник на промени

Верзија = NULL
8.4.0 statement очекува Odbc\Result инстанца сега; претходно, а resource се очекуваше.
8.1.0 Користењето null за dir_handle сега е застарено. Наместо тоа, треба експлицитно да се обезбеди последниот отворен рачка на директориумот.

Белешки од корисници 5 белешки

ZAPtheZAPs dot schulze dot zap at zap dot telstra dot com
21 години пред
a revised version marius' code that works with Memo fields. (also returns rather than prints strings)

function ODBCResourceToHTML($res, $sTable, $sRow)
{$cFields = odbc_num_fields($res);
 $strTable = "<table $sTable ><tr>";  
 for ($n=1; $n<=$cFields; $n++)
   {$strTable .= "<td $sRow><b>". str_replace("_", " ", odbc_field_name($res, $n)) . "</b></td>";}
   $strTable .= "</tr>";
   while(odbc_fetch_row($res))
   { $strTable .= "<tr>";
      for ($n=1; $n<=$cFields; $n++)
             {$cell = odbc_result($res, $n);
    if ($cell=='') {$strTable .= "<td $sRow>&nbsp;</td>";}
             else {$strTable .= "<td $sRow>". $cell . "</td>";}}
     $strTable .= "</tr>";}
 $strTable .= "</table>";
 Return $strTable;} 

DEAR MODERATORS: you would save yourselve much much time by making this entire manual into a wiki (ie like http://en.wikipedia.org ) and within a year this would be the best manual on anything!!

best wishes, Erich
marius at stones dot com
пред 22 години
I've written this little function that functions simirarly to odbc_result_all, but works with MySQL:

/**
 * This function emulates the odbc_result_all function, which will return a HTML table cosisting of
 * the results of an SQL query. 
 * Usage: pass a mysql result set to this function, and it will return (not output) a string containing 
 * an HTML table
 * Parameters: 
 * - $result is your mysql result set (result of a mysql_query() function call)
 * - $tableFeatures is a string containing any HTML TABLE features you would like in the table 
 *   (eg. BORDER="0" etc.)
 */
function _mysql_result_all($result, $tableFeatures="") {
  $table .= "<!--Debugging output for SQL query-->\n\n";
  $table .= "<table $tableFeatures>\n\n";
  $noFields = mysql_num_fields($result);
  $table .= "<tr>\n";
  for ($i = 0; $i < $noFields; $i++) {
    $field = mysql_field_name($result, $i);
    $table .= "\t<th>$field</th>\n";
  }
  while ($r = mysql_fetch_row($result)) {
    $table .= "<tr>\n";
    foreach ($r as $kolonne) {
      $table .= "\t<td>$kolonne</td>\n";
    }
    $table .= "</tr>\n";
  }
  $table .= "</table>\n\n";
  $table .= "<!--End debug from SQL query-->\n\n";
  return $table;
}

Enjoy...
martin dot vgagern at gmx dot net
yasuo_ohgaki at hotmail dot com
As some people stated in the ODBC overview, some buggy drivers always return the number of rows to be -1. AFAIK the only way to help this situation is to count the rows by calls to odbc_fetch_into or odbc_fetch_row and then build the table yourself.
rabbott at calstatela dot edu
yasuo_ohgaki at hotmail dot com
odbc_result_all($result) cycles through 
$result. So a subsequent call to odbc_fetch_row($result) will fail.
You must use odbc_fetch_row($result, 1)
to reset $result.  (But when I do that,
I get a crash!)
alvaro на demogracia точка com
пред 16 години
The $format parameter is an optional string that gets inserted in the <table> tag. The string is printed as-is. E.g.:

<?php
odbc_result_all($res, 'id="users" class="listing"');
?>

... prints:

<table id="users" class="listing" >...
На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.