php implode question -


So I'm searching for one and I am using an implode in my selection statement, which I find useful is. Basically this search engine will have 3 different selections, which will select different things based on different criteria and when I use my implode, I get an error of invalid arguments.

Here is my SQL statement:

 $ sq = "select camp select camping camp, start camps, type camps, camp.indere, camp link form (join gender in gender) Camp.id = gender.cap_id) Enter camp. ID = grade Camp_id) join camp.id = interests.camp_id where ((grade.year = '' .implode ('\' or grade.year = '', $ Age. '') And gender.gender = '". $ Gender."') Or ((interests: activation = '' .implode ('\' or interests) Ruth = \ '', $ array). '' And (grade age = ''. $ Age. '' And gender.gender = ''. $ Gender. '' ')) "

The second is to push for interests where I got my problem and $ array an array One more thing that I do not understand is that when I run my code, I will get the right results, but I am still getting the error that I am passing an invalid argument.

You can believe what PHP says, generally. If it says that this is a If you do not have an array then you probably do not exceed any array.

And a small tip to save you some code: A IN () is in the statement MySQL: < / P>

  $ sql = "Select camp camp.title, camp.startDay, camp.typeOfCamp, camp.endDay, camp.link FROM (join Camp.id = gender on Camp Inner gender .camp_id) Enter INNER camp.id = Grade on camp_id Join camp.id camp.id = interests.camp_id where (grade. Years IN ("Implode (',', $ age.) And gender gender = ''. $ Gender. '') Or (interests (".", "$ Array.") And grade. Era = ". $ Age." And gender gender = ''. $ Gender. '' '');; " / Code>  

To save duplicates, gender.gender = $ gender and (probably) optimize the query:

  $ sql = "Choose DISTINCT camp.title, camp.startDay, camp.typeOfCamp, camp.endDay, camp.link from FROM (Join camp (include camp at camp.id = gender.camp_id) Join INNER Amp.id = grades.camp_id) Join INNER camp camp.id = interests.camp_id where gender gender = ''. $ Gender '' And 'grade' ("." ("." "Implode (',', $ age).") Or (interests. (".implode" ("," ", $ array)." '') And grade Age = ". $ Age."));  

In addition to this, I think MySQL does not need to use all those brackets to join:

  $ sql = "Select camp Camp.title, camp.start.com, Camp.typeOfCamp, camp.endDay, camp.link Join Camp at camp camp at camp.id = gender.camp_id camp.id = grades.camp_id Join INNER camp camp .id = interests.camp_id where gender gender = ''. $ Gender. '' And (grade year IN ("." Implode (',', $ age).) (Or interests. ) Implode ("','", $ array). "') And grade. Era =". $. "))";  

The query should now be better for understanding.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -