bazz
02-09-2009, 05:09 AM
Hi,
The following code builds an array with the value separated with commas. mysql doesn't ike it in an IN(@array) clause and I think the values should be surrounded by ' '
foreach my $facility (sort keys %params){
if ($facility eq 'facilities_throughout')
{
push(@throughout,$params{$facility});
}
elsif ($facility eq 'room_specific')
{
push(@room_specific,$params{$facility});
}
}
$throughout = (join("/ ",(@throughout)));
$throughout =~ s/\0/,/g;
what must I do to get the array to work in a mysql query
where IN ( @throughout )
I have tried it with $throughout but neither works.
the error is:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'player,Central Heating,Double Glazing )
GROUP
BY b' at line 7 at
bazz
The following code builds an array with the value separated with commas. mysql doesn't ike it in an IN(@array) clause and I think the values should be surrounded by ' '
foreach my $facility (sort keys %params){
if ($facility eq 'facilities_throughout')
{
push(@throughout,$params{$facility});
}
elsif ($facility eq 'room_specific')
{
push(@room_specific,$params{$facility});
}
}
$throughout = (join("/ ",(@throughout)));
$throughout =~ s/\0/,/g;
what must I do to get the array to work in a mysql query
where IN ( @throughout )
I have tried it with $throughout but neither works.
the error is:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'player,Central Heating,Double Glazing )
GROUP
BY b' at line 7 at
bazz