If you want to rewrite some modifications to an SQL table, first you need a select ZSQL method, and an Update SQL Tool Object. You need to use the fetchRow( ) and fetchInto( ) methods in your database and put data in numeric arrays. And in your program you need to use associative arrays or objects by passing an additional parameter to either method. For associative arrays, use DB_FETCHMODE_ASSOC:
create table utest
(id integer not null primary key,
name varchar(100) not null,
is_male smallint,
birth_date date,
birth_time time,
modified timestamp);
Code:
while($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
print $row['sign']."\n";
}
while($sth->fetchInto($row,DB_FETCHMODE_ASSOC)) {
print $row['sign']."\n";
}
For objects, use DB_FETCHMODE_OBJECT:
Code:
while($row = $sth->fetchRow(DB_FETCHMODE_OBJECT)) {
print $row->sign."\n";
}
while($sth->fetchInto($row,DB_FETCHMODE_OBJECT)) {
print $row->sign."\n";
}
Bookmarks