I am trying to perform a query that takes the string from a series of checkboxes and returns rowes which have a field which contains allthese strings in any order. This is the code i am using:[perl tables="products"] @array = split(/-/,$CGI->{from}); my $res = '';$sql = "SELECT * FROM products WHERE icons LIKE '%'";foreach(@array){ $sql .= " AND icons LIKE '%" . $_ . "%'"; } $Tag->query({sql=>$sql,hashref=>'results',table=>'products'}); foreach my $row (@{$Tmp->{results}}) { $res .= $row->{description} . "test<br>"; } return $res;[/perl]This returns no string. I have changed the return to return the sql string and then ran the same sql query in directsql and this returns the correct products. Changing it back to return res brings back nostring.This does not make any sense to me.
Kevin gave the solution to change:
@array = split(/-/,$CGI->{from});
in
@array = split(/\0/,$CGI->{from});
What confuses me in this is that above you say that you have returned the
sql string from this perl block and with that you got a correct query.
Perhaps Kevin can shed a light on that one aswell? I'd think that you would
not be able to have done a split with the - , so there would not have been a
correct sql query in the first place? Or is there something magic going on?
CU,
Gert
_______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.