[ic] no access for database

Stefan Hornburg (Racke) racke at linuxia.de
Thu Jul 19 07:55:28 EDT 2007


graham hadgraft wrote:
> Hi Stefan,
> 
> I am using the latest current stable version of interchange 5.4.2.
> And this catalog only uses the one database.
> 
> I am using this code to loop through a list of a couple of 100 fields
> named 1,2,3 etc and if the 1_quantity field has a value perform an
> insert into the database.
> 
> [perl tables=quote_items]
> 
> 
> 
> 
> 
> 
>     my $code = $Scratch->{code};
>     my $version = $Scratch->{version};
>     my $count = $CGI->{count};
>     my $customer = $CGI->{customer_id};
>     my $project = $CGI->{project_id};
>     my $ret;
> 
>     for($i=1;$i<=$count;$i++) {
>        
> 
>         my $quantity = $CGI->{$i._quantity};
>         if ($quantity) {
>             my $sku = $CGI->{$i._sku};
>             my $description = $CGI->{$i._description};
>             my $price = $CGI->{$i._price};       
>             my $weight = $CGI->{$i._weight};
>             my $group_text = $CGI->{$i._group_text};
>             my $group_selected = $CGI->{$i._group_selected};
>             my $category = $CGI->{$i._category};
> 
>             my $group;
> 
>             if ($group_text) {
>                 $group = $group_text;
>             } else {
>                 $group = $group_selected;
>             }
>             $sql = "INSERT INTO quote_items VALUES ('$code', '$project',
> '1n',
> '$sku', '$description', '$quantity', '$price', '$weight', '$group',
> '$category', '', '')";
>             my $ins = $Tag->query({
>                      sql => $sql,
>                    hashref => 'ins',
>             });
> 
>             $code++;
>         }
> 
>            
>     }
> return $ret;
> [/perl]
> 
> I hope you can give me some help.

Try to use $Db{'quote_items'}->query(...) instead of your code.
This should hopefully produce a more instructive error message.

Also, never use $CGI in embedded Perl without proper sanitization.

Regards
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list