note 114332 added to function.odbc-num-rows
| From: | panchome66 at gmail dot com | Date: | Sun, 09 Feb 2014 21:23:04 +0000 |
| Subject: | note 114332 added to function.odbc-num-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198440@lists.php.net to get a copy of this message | ||
Este codigo se probó en SQL Server 2000, no se probó en otras versiones como 2005 o 2008. Aun
asi no se aplica para MySQL, porque no existe la tabla "sysindexes":
$cnx = odbc_connect("dbSQLEmpresa","Admin","123");
if ($cnx)
{
$rs = odbc_exec($cnx, "SELECT * FROM alumnos");
$f = odbc_num_fields($rs);
$r = odbc_num_rows($rs);
$r = LFRJ_odbc_num_rows($cnx,"alumnos");
echo "<table border = '1'>";
for ($i = 1; $i <= $f; $i++)
{
$n = odbc_field_name($rs, $i);
echo "<th>", $n, "</th>";
}
while(odbc_fetch_row($rs))
{
echo "<tr>";
for ($i = 1; $i <= $f; $i++)
{
$d = odbc_result($rs, $i);
echo "<td>", $d, "</td>";
}
echo "</tr>";
}
echo "<tr><td colspan = '" . $f . "'>Campos(" . $f .
") Registros(" . $r . ")</td></tr>";
echo "</table>";
}
odbc_close($cnx);
function LFRJ_odbc_num_rows($cnx,$Tabla)
{
$rs = odbc_exec($cnx, "SELECT rows FROM sysindexes WHERE id = OBJECT_ID('" . $Tabla
. "') AND indid < 2;");
return odbc_result($rs, 1);
}
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.odbc-num-rows.php
Edit -- https://master.php.net/note/edit/114332
Del: integrated -- https://master.php.net/note/delete/114332/integrated
Del: useless -- https://master.php.net/note/delete/114332/useless
Del: bad code -- https://master.php.net/note/delete/114332/bad+code
Del: spam -- https://master.php.net/note/delete/114332/spam
Del: non-english -- https://master.php.net/note/delete/114332/non-english
Del: in docs -- https://master.php.net/note/delete/114332/in+docs
Del: other reasons-- https://master.php.net/note/delete/114332
Reject -- https://master.php.net/note/reject/114332
Search -- https://master.php.net/manage/user-notes.php