I'm not sure what you mean...
$DB is the Links global to the MySQL DBI database handle object.
You use it to connect and get a table handle:
$db = $DB->table ('table_name')
$db is now the table pointer, and used to do selects, queries, adds, etc to a specific table in the database $DB
Once you get your $db table handle, you can:
$db->select_options ()
then you need to do a
$sth = $db->select
to execute the select, and put the results into a statement handle. the $db is a table object, not a statement handle.
To see if there were any hits, you would do:
$db->hits (returns the total hits on the last query without any Limit statement restrictions ie: total database matches)
Then, you could start iterating through the results, using the STATEMENT HANDLE :
while (my $row = $sth->fetchrow_hashref) {
..... stuff ......
}
Where $row is a reference to the returned hash of values (same as $rec in the other scripts)
You need to do the
if ($db->hits) {
while (my $row = $sth->fetchrow_hashref){
.... stuff ....
}
}
Construct, in order to avoid undefined value errors trying to use a null $sth.
Or did I miss the point of your post??
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.
$DB is the Links global to the MySQL DBI database handle object.
You use it to connect and get a table handle:
$db = $DB->table ('table_name')
$db is now the table pointer, and used to do selects, queries, adds, etc to a specific table in the database $DB
Once you get your $db table handle, you can:
$db->select_options ()
then you need to do a
$sth = $db->select
to execute the select, and put the results into a statement handle. the $db is a table object, not a statement handle.
To see if there were any hits, you would do:
$db->hits (returns the total hits on the last query without any Limit statement restrictions ie: total database matches)
Then, you could start iterating through the results, using the STATEMENT HANDLE :
while (my $row = $sth->fetchrow_hashref) {
..... stuff ......
}
Where $row is a reference to the returned hash of values (same as $rec in the other scripts)
You need to do the
if ($db->hits) {
while (my $row = $sth->fetchrow_hashref){
.... stuff ....
}
}
Construct, in order to avoid undefined value errors trying to use a null $sth.
Or did I miss the point of your post??
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.