Hi all,
is there a cleaner way of doing this?
for ($g = 0; $g < count($tempjoin); $g++)
{
$tempjoin2[$g] = explode("ON", $tempjoin[$g]);
for ($h = 0; $h < count($tempjoin2[$g]); $h++)
{
$tempjoin3 = explode("WHERE", $tempjoin2[$g][$h]);
for ($f = 0; $f < count($tempjoin3); $f++)
{
if (strpos($tempjoin3[$f], "="))
{
$tempjoin4 = explode("=", $tempjoin3[$f]);
for ($d = 0; $d < count($tempjoin4); $d++)
{
$joins[$join_nudge2][$join_nudge] = explode(".", $tempjoin4[$d]);
$join_nudge++;
}
$join_nudge2++;
$join_nudge = 0;
}
}
}
}
What it's doing is analysing an sql string and splitting it into segments
First splitting "ON"
then "WHERE"
cycling through all segments, seeing if they contain an equals sign "="
If equals found, further split segment into it's values
(building an SQL parser to analyse sql select statements and populate an array)
It works, but this particular bit is messy
anyone got any ideas on how to clean it up (explode doesn't seem to like array inputs)
Thanks in advance
Tony
Setup:
Windows 2000 Professional
Apache 2.0.54
Php 4.3.11
Php as apache module