Mercurial > epgrec.yaz
comparison DBRecord.class.php @ 17:d3ee3927eb3a
fix: fetch_array() in DBRecord.class.php
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Thu, 16 Jul 2009 11:52:00 +0900 |
parents | f5a9f0eb4858 |
children | 01a8fdc0cebb |
comparison
equal
deleted
inserted
replaced
16:cf19005e65d1 | 17:d3ee3927eb3a |
---|---|
56 function fetch_array( $property , $value, $options = null ) { | 56 function fetch_array( $property , $value, $options = null ) { |
57 $retval = array(); | 57 $retval = array(); |
58 | 58 |
59 $sqlstr = "SELECT * FROM ".$this->table. | 59 $sqlstr = "SELECT * FROM ".$this->table. |
60 " WHERE ".mysql_real_escape_string( $property ). | 60 " WHERE ".mysql_real_escape_string( $property ). |
61 " like '".mysql_real_escape_string( $value )."%'"; | 61 "='".mysql_real_escape_string( $value )."'"; |
62 | 62 |
63 if( $options != null ) { | 63 if( $options != null ) { |
64 $sqlstr .= " ".mysql_real_escape_string( $options ); | 64 $sqlstr .= "AND ".$options; |
65 } | 65 } |
66 $res = $this->__query( $sqlstr ); | 66 $res = $this->__query( $sqlstr ); |
67 while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { | 67 while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { |
68 array_push( $retval, $row ); | 68 array_push( $retval, $row ); |
69 } | 69 } |
70 | 70 |
71 return $res; | 71 return $retval; |
72 } | 72 } |
73 | 73 |
74 function __set( $property, $value ) { | 74 function __set( $property, $value ) { |
75 if( $property == "id" ) throw new exception( "set:idの変更は不可" ); | 75 if( $property == "id" ) throw new exception( "set:idの変更は不可" ); |
76 // id = 0なら空の新規レコード作成 | 76 // id = 0なら空の新規レコード作成 |