I have a script which mostly works, but when I get to the part with hashes, it stops. I'm obviously doing something very basically wrong, but I can't see what. (been staring at so long it could be anything.) A segment of the code is below:
#!/usr/local/perl -wT use strict; use CGI;
# Do some stuff to identify the value of $marker which will be a number
# Do MySQL query to grab the data to be manipulated
my $dbh=connect(DBI:mysql:database, "user", "password");
my $query=("SELECT task_ID, priority FROM task_list WHERE priority >$marker");
my $reponse->prepare($query);
$response->execute;
# $ response should now contain a # reference to a hash filled with task_ID, priority pairs # Dereference $response
my %hash=%($response); $response->finish;
# Subtract 1 from each value in the hash my ($key, $priority, %newhash);
foreach $key (keys(%hash)){ my $priority=$hash{$key}--; %newhash=($key, $priority); }
# Put the new $priority values into the MySQL table
$query=("UPDATE task_list SET priority=? WHERE task_ID=?"); $response->prepare($query);
foreach $key (keys{%newhash}){ $priority=$newhash{$key}; $response->execute($priority, $key); }
$response->finish;
# Test the result
print "Content-Type: text/html\n\n";
$query=("SELECT" task_ID, priority FROM task_list"); $response->prepare($query); $response->execute;
while($key, $priority){ print "Priority: $priority Task Ident: $key<br>\n\n"; }
Would someone be patient enough to point out the mistake?
Thanks
Dave
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]