Paul DuBois <paul@stripped> wrote:
I don't really understand what you're trying to accomplish, exactly...
On Thu, 29 Apr 1999, Vivek Khera wrote:
<snip>
> Wildcard substitution is a DBI thing, not a mysql command line thing.
>
> try "select sid from slips where sid=3;" in mysql command prompt.
By "mysql command line", I mean when I log in (/usr/local/mysql/bin/mysql)
and select a database. At the mysql> prompt, the wildcard "%" certainly
does work (with no relevance to DBI), and your suggestion above works,
also (sid #3 exists). However, it seems when I'm successful in finding a
match, that's when this thing fails, and I get
"execute called with 1 bind variables when 0 are needed at ./d.cgi line...
"Database handle destroyed without explicit disconnect."
What I'm trying to do is this:
<snip>
my $query = <<"EOS";
SELECT sid FROM slips WHERE sid=3
EOS
my $sth = $dbh->prepare($query) or die ...<snip>
$sth->execute($sid);
while(@row = $sth->fetchrow_array) {
print "@row\n";
}
I'd like to extract the values of sid (later, into a file). What I do
right now for archiving (into a similar--archiving--database) is to get
the sid values into a file to list the entries that are "older than...",
and then I can use these values to get other, pertinent table entries.
After loading these data into the archive database, I can delete the
appropriate stuff from the active database.
What I'm trying to do is automate this process, using a cron script.
table explain:
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| sid | int(11) | | PRI | 0 | auto_increment |
Thanks for your help, both of you!
ck