Hey guys
So my question is related to explode()
Let me illustrate this with the codes (excerpt) first:
foreach ($query as $querys){
echo $querys;
$querys= explode("null",$querys);
var_dump($querys);
$check = "select first_name, last_name, email from mailing_list WHERE cell like '%$querys%'";
}
}
Output of "echo $querys" is:
Not SpecifiedNot SpecifiedNeuronGlia CellNeuronNeuronNeuronNeuron
As you can see this is one long string, and I only need the Glia Cell from this since it matches the data from the table
Then the output for var_dump($querys) is
array(1) { [0]=> string(13) "Not Specified" } array(1) { [0]=> string(13) "Not Specified" } array(1) { [0]=> string(6) "Neuron" } array(1) { [0]=> string(9) "Glia Cell" } array(1) { [0]=> string(6) "Neuron" } array(1) { [0]=> string(6) "Neuron" } array(1) { [0]=> string(6) "Neuron" } array(1) { [0]=> string(6) "Neuron" }
Why are the keys all [0]? Shouldn't the keys start with [0] then go all way up?
And as you could expect, the sql command couldn't go through ... so how could I fix it up so only the specific string could be chosen?
By the way, I used "null" as delimiter for explode() since there's no space in between the long string, but is this correct?
Thanks