Ok, right now i have an array that the user enters into a form and when they submit it, it is loaded into a PHP script that i have set into an iFrame so that you can modify the mysql database in real time (sorta)

but heres my problem. i want the user to type in somthing, and when they submit it, be displayed with color syntaxing in the iFrame before execution.

Right now im using the function break to seperate the array at all the spaces, but now i need to compare those seperations to an array which contains the syntaxing information.


here is the users array they might type in.

REMOVE FROM *.* WHERE ....etc //this is the liv_mysql_data field

is saved like this

$post = $_POST[live_mysql_data]

it will be broken up by the array like this

then using this function.

$broken = break (" ", $post)
the array is broken at all the spaces.

but now i need to take the $broken and compare it to

this array

array ("REMOVE" => "location of some style sheet for formatting", "FROM" => "location of some style sheet for formatting", .....etc)

and have it output like this


echo "<div id="location of the style sheet that matches the $broken term">$broken</div>";


i hope im not being to vague, or im not missing somthing to obvious. ive been working on this for some time now and have been stuped with it. i can easily break up the two arrays, i just dont know how to compare the output and tell it what style sheets to use.

Member Avatar for LastMitch

@Killer_Typo

ive been working on this for some time now and have been stuped with it. i can easily break up the two arrays, i just dont know how to compare the output and tell it what style sheets to use.

I know it's 8 years too late if you have solve this issue already.

You can used this function to compare 2 arrays:

http://php.net/manual/en/function.array-diff.php

You can also used this function to compare 2 arrays:

http://php.net/manual/en/function.array-intersect.php

or you could just used this:

http://ask.amoeba.co.in/compare-two-arrays-in-php-using-array_diff-check-whether-arrays-are-equal/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.