- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
class recordset {
/*используется для оптимизации работы с MySQL*/
var $res;
function recordset($sql,$link="") {
if ($link!="")
{
$this->res=mysql_query($sql,$link);
if (!$this->res)
{
echo $sql;
echo mysql_error($link);
}
}
else
{
$this->res=mysql_query($sql);
if (!$this->res)
{
echo $sql;
echo mysql_error();
}
}
}
function gr() {
$row=mysql_fetch_row($this->res);
if ($row) {for ($i=0;$i<count($row);$i++) $row[$i]=convert_cyr_string($row[$i],"k","w");}
return $row; }
function ga() {
$row=mysql_fetch_array($this->res);
if ($row) {foreach($row as $key=>$val) $row[$key]=convert_cyr_string($val,"k","w");}
return $row; }
function nr() {
$num=mysql_num_rows($this->res);
return $num; }}
еще один перл того же автора, что и в 2х предыдущих опубликованных мной говнокодах.
На этот раз старорежимный ООП - великолепный класс.