Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 703553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:50:38+00:00 2026-05-14T03:50:38+00:00

Please help me to rectify my code. Here I have described the code what

  • 0

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… hence the End reult should be..

Array
(
    [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
)

Array
(
    [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
)

Array
(
    [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
)

Array
(
    [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
)

Array
(
    [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
)

How to accomplish this..Please help….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:50:38+00:00Added an answer on May 14, 2026 at 3:50 am

    You could put a limit on the MySQL statement

    “SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = ‘”.$row3[‘TABLE_SCHEMA’].”‘ and TABLE_NAME = ‘”.$row3[‘TABLE_NAME’].”‘ LIMIT 1″

    then it will only return the one result

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 365k
  • Answers 365k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the data in the /proc filesystem to… May 14, 2026 at 3:57 pm
  • Editorial Team
    Editorial Team added an answer Do you still get the error when you use a… May 14, 2026 at 3:57 pm
  • Editorial Team
    Editorial Team added an answer You can use array_chunk to create a single array comprised… May 14, 2026 at 3:57 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.