[ic] SQL query returning no results

graham hadgraft graham.hadgraft at gmail.com
Fri Oct 27 06:24:45 EDT 2006


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 all
these 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 no
string.

This does not make any sense to me.


More information about the interchange-users mailing list