Something went awfully wrong in PHP+MySQL :(

Sorry if am deviating you from the problem!

The above posted code to select the relation set works fine.

If you are not able to incorporate the perl code into php,
what you could do is have the perl script as a separate script and call that from php script

Something like,

perl script to be named as run.pl
within php,
select column1, column2 from table1; ## dump the output in a file
call the perl file run.pl

and now you should have the output needed.

I guess thats a real help now... Could you please add a few concepts to that code so that I can understand it a little more? (I'm sorry... I'm sorry)

Let me try my best ! If not let me know :slight_smile:

so in your php code, you have to add a query statement like
select ip1, trace1 from iptables;

>>>I suppose you would open a cursor to iterate over the result set of the above query.<<<

for every iteration of the cursor over the result set, write the output to a file.

so you would have output like,
<col1_output>, <col2_output>

write the above output to a file.

After the looping over the result set.

Do some system command over the perl script with the output filename obtained above

( am not sure of the syntax in php )

$cmd = "run.pl " . $filename " > output.txt";
system($cmd);

now the result should there in the file output.txt

these are more or less like a samples, please modify it according to php.

On second thoughts, I could get the perl script to run :slight_smile: I've given it a sample input and it does work... (obviously it had to considering that it was written by you and not me hehe) However a few things:

I've created a file with the following contents:

A | B
B | C
C | D
A | E
G | H
I | K

And then ran the perl script on it... It gives me the following input:

first set:A
first set: D
first set:C
first set:E
first set:B
second set:H
second set:K
second set:I
second set:G

I have a few things to say/ask:

  1. G,H and I,K aren't related so I,K shoud've been in Third Set...
  2. I was trying for a way that would preserve the link information too...
    I guess I wasn't clear in what I wanted... There could be many number of groups as such...