Well don't hate me for coming back here. I am shamed
and embarassed enough.
Advertising
And while I appreciate all the great code and feedback
received , I've run into a glitch.
(oi) Because I'm using CodeCharge, it's not easy to
just insert custom code anywhere. That is one of
those code generators. I suppose if I had more hands
on php coding the way could be found.
So here is what I have:
//Here is defines the field variable and uses
//CodeCharge function to grab the variable
$s_Industry = CCGetParam("s_Industry", "");
$s_LocationState = CCGetParam("s_LocationState", "");
$s_TaxTerm = CCGetParam("s_TaxTerm", "");
//Here is the parsing of the array. I'm not sure
what the $proj variable is for. I gather it's a
holder for the array values
if (count($s_Industry) > 0 AND is_array($s_Industry))
{
foreach ($s_Industry as $key => $value) {
if ($Proj1 != "") $Proj1 = $Proj1.",";
$Proj1 = $Proj1."'".$value."'";
}
}
//Parsing next array
if (count($s_LocationState) > 0 AND
is_array($s_LocationState))
{
foreach ($s_LocationState as $key => $value) {
if ($Proj2 != "") $Proj2 = $Proj2.",";
$Proj2 = $Proj2."'".$value."'";
}
}
//Parsing file array
if (count($s_TaxTerm) > 0 AND is_array($s_TaxTerm))
{
foreach ($s_TaxTerm as $key => $value) {
if ($Proj3 != "") $Proj3 = $Proj3.",";
$Proj3 = $Proj3."'".$value."'";
}
}
Here is what will be the death of me :)
First the where condition below is being appended to
anoher file in my main sql statement (don't ask:))
CC keeps their code in various sections and files.
Anyway , if you remember yesterday, it was determined
that I needed the where condition to be dynamically
created based on the user input.
Obviously the code below does nothing of that sort.
So as a start, I'm trying to figure out what I can do
with this section here (since this is really what
needs to be changed, I think) to make it all right.
if ($Proj1)
$VendorJobs->ds->SQL.= " AND (`VendorJobs`.Industry IN
(".$Proj1."))";
if ($Proj2)
$VendorJobs->ds->SQL.= " AND
(`VendorJobs`.LocationState IN (".$Proj2."))";
if ($Proj3)
$VendorJobs->ds->SQL.= " AND (VendorJobs.TaxTerm IN
(".$Proj3."))";
echo "SQL:". $VendorJobs->ds->SQL."<br>";
As a crash course on this issue, search form has 6
fields, user may enter 1 or up to all 6 values, but
the results should be refined as more values are
added. In other words AND is correct conditional ,
but has to allow for user to choose how many values
they want to put in.
Anyway , don't throw me off the list yet! I am reading
on PHP, but I have gone pretty far on this project and
prefer to finish it without diverting back/
Thank you,
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php