Please help me to Rectify my code.
- by Parth
Please help me to rectify my code.
Here I have described the code what and why I am using... and finally whatI am getting at the end, but the end output is not the way what I want... Please help and tell how I can rectify it...
$count = substr_count($row4['ACTION_STATEMENT'], " IF (NEW.");/*here i will get how many time i will get " IF (NEW." in my string.*/
$exp1 = explode("(NEW.",$row4['ACTION_STATEMENT']);/*I exploded it from "NEW."*/
/*echo "<pre>";
print_r($exp1);*/
for($i=1;$i<count($exp1);$i++)/*Loop for values in $exp1*/
{
//echo $exp1[$i];
$exp2[] = explode(" !=",$exp1[$i]);/*exploded by " !="*/
}//print_r($exp2);
$flag = true;
if($flag == true)
{
$column = mysqli_query($link,"SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = '".$row3['TABLE_SCHEMA']."' and TABLE_NAME = '".$row3['TABLE_NAME']."'"); /*This query will give me 21 values*/
while ($row5 = mysqli_fetch_array($column))
{/*echo "<pre>pd";
print_r($row5);*/
foreach($exp2 as $fieldsarr)/*loop used for further comaprison of $exp2 with above query values*/
{
echo "<br>";
//print_r($fieldsarr);
if($fieldsarr[0] == $row5['COLUMN_NAME'] )/*Comparison of values*/
{
if($fieldsarr[0]!='id')
{//echo $fieldsarr[0];
mysqli_select_db($link,'pranav_test');
$aud = mysqli_query($link,"SELECT * FROM `jos_menuaudit`") or die("DEAD".mysqli_error());
while($audit = mysqli_fetch_array($aud))
{
echo "<pre>";
echo $fieldsarr[0].$row5['COLUMN_NAME'];
print_r($audit); /*Values displayed according to query written above after true comparsion of conditions*/
}
}
}
}
mysqli_select_db($link,'information_schema');
}
}
Now from above code The output I am getting is
namenameArray
(
[0] => 1
[id] => 1
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_PSD_111
[oldvalue] => test_PSD_111
[4] => test_SPD_111
[newvalue] => test_SPD_111
[5] => 2010-03-24 11:42:26
[changedone] => 2010-03-24 11:42:26
)
namenameArray
(
[0] => 2
[id] => 2
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_SPD_111
[oldvalue] => test_SPD_111
[4] => test_SD_111
[newvalue] => test_SD_111
[5] => 2010-03-24 11:44:22
[changedone] => 2010-03-24 11:44:22
)
namenameArray
(
[0] => 3
[id] => 3
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_SD_111
[oldvalue] => test_SD_111
[4] => test_PSD_111
[newvalue] => test_PSD_111
[5] => 2010-03-24 11:46:28
[changedone] => 2010-03-24 11:46:28
)
namenameArray
(
[0] => 4
[id] => 4
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_PSD_111
[oldvalue] => test_PSD_111
[4] => test_PD_111
[newvalue] => test_PD_111
[5] => 2010-03-24 11:47:30
[changedone] => 2010-03-24 11:47:30
)
namenameArray
(
[0] => 5
[id] => 5
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_PD_111
[oldvalue] => test_PD_111
[4] => test_P_111
[newvalue] => test_P_111
[5] => 2010-03-24 11:49:25
[changedone] => 2010-03-24 11:49:25
)
aliasaliasArray
(
[0] => 1
[id] => 1
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_PSD_111
[oldvalue] => test_PSD_111
[4] => test_SPD_111
[newvalue] => test_SPD_111
[5] => 2010-03-24 11:42:26
[changedone] => 2010-03-24 11:42:26
)
aliasaliasArray
(
[0] => 2
[id] => 2
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_SPD_111
[oldvalue] => test_SPD_111
[4] => test_SD_111
[newvalue] => test_SD_111
[5] => 2010-03-24 11:44:22
[changedone] => 2010-03-24 11:44:22
)
aliasaliasArray
(
[0] => 3
[id] => 3
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_SD_111
[oldvalue] => test_SD_111
[4] => test_PSD_111
[newvalue] => test_PSD_111
[5] => 2010-03-24 11:46:28
[changedone] => 2010-03-24 11:46:28
)
aliasaliasArray
(
[0] => 4
[id] => 4
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_PSD_111
[oldvalue] => test_PSD_111
[4] => test_PD_111
[newvalue] => test_PD_111
[5] => 2010-03-24 11:47:30
[changedone] => 2010-03-24 11:47:30
)
aliasaliasArray
(
[0] => 5
[id] => 5
[1] => 0
[menuid] => 0
[2] => name
[field] => name
[3] => test_PD_111
[oldvalue] => test_PD_111
[4] => test_P_111
[newvalue] => test_P_111
[5] => 2010-03-24 11:49:25
[changedone] => 2010-03-24 11:49:25
)
thatis, all the five values from query are displayed on every single comaprison getting true. Now here What I want is after the completion of every comparison I want to display the final query result Only Once...
How to accomplish this..Please help....