Welcome Guest, Not a member yet? Register   Sign In
Strange phenomenon passing array through active record class
#3

[eluser]Dandy_andy[/eluser]
Hi Tim,
I did that on the last portion of my query that uses the results from 'search_exclusions' and the results are just as I expected them to be. I don't think there is a problem with the SQL query. It seems to be an issue with the array and that's what I can't understand. Just to show you the difference (and there isn't any at all), if I create an array manually as per the code below:-

Code:
$excluded_members = array(9012, 9021, 9031);

The result of the last query (and the one that works fine) is:-

Code:
SELECT `members`.`screenname`, `members`.`mem_id`, `members_photos`.`pho_id`, `members_photos`.`s3_region` FROM (`members`) LEFT JOIN `members_photos` ON `members_photos`.`mem_id` = `members`.`mem_id` LEFT JOIN `members_profile_complete` ON `members_profile_complete`.`mem_id` = `members`.`mem_id` LEFT JOIN `members_profile_options` ON `members_profile_options`.`mem_id` = `members`.`mem_id` WHERE `members_profile_complete`.`sex_dob` = '1' AND `members_profile_complete`.`profile` = '1' AND `members_photos`.`main` = '1' AND `members_photos`.`approved` = '1' AND `members`.`sex` = 'male' AND `members`.`region` = 'london' AND `members_profile_options`.`height` > '4' AND `members_profile_options`.`body` = '2' AND `members_profile_options`.`smoking` = '1' AND `members_profile_options`.`income` = '4' AND `members`.`mem_id` != '9001' AND `members`.`mem_id` NOT IN (9012, 9021, 9031)

and if I use the result produced by the dynamically created array, the result is also:-

Code:
SELECT `members`.`screenname`, `members`.`mem_id`, `members_photos`.`pho_id`, `members_photos`.`s3_region` FROM (`members`) LEFT JOIN `members_photos` ON `members_photos`.`mem_id` = `members`.`mem_id` LEFT JOIN `members_profile_complete` ON `members_profile_complete`.`mem_id` = `members`.`mem_id` LEFT JOIN `members_profile_options` ON `members_profile_options`.`mem_id` = `members`.`mem_id` WHERE `members_profile_complete`.`sex_dob` = '1' AND `members_profile_complete`.`profile` = '1' AND `members_photos`.`main` = '1' AND `members_photos`.`approved` = '1' AND `members`.`sex` = 'male' AND `members`.`region` = 'london' AND `members_profile_options`.`height` > '4' AND `members_profile_options`.`body` = '2' AND `members_profile_options`.`smoking` = '1' AND `members_profile_options`.`income` = '4' AND `members`.`mem_id` != '9001' AND `members`.`mem_id` NOT IN (9012, 9021, 9031)

Both completely identical yet the last one will fail if I remove the last query function. I am totally puzzled here. If I remove the last query function which is showing the array in the NOT IN part at the end, the error I get is as per the screenshot attachment which appears to be missing the array at the end. What the hell is going on?


Messages In This Thread
Strange phenomenon passing array through active record class - by El Forum - 08-01-2014, 12:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB