if at first you don't succeed, try again, jaja.
i'm still working on this project, i have the latest version of the script that has been developed (i removed everything between {}) and i'll try to post my understanding of what is needed still. i'm no programmer, so please bear with me.
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("estudio", $con);
$result = mysql_query("SELECT * FROM legis57pan WHERE id=13");
here the table name will be set by hand, it's only 12 tables i have, all with the same structure, so once the command works for one, it should work for all. but, the command is all geared to work for guy # 13. i would need the command to detect the number of guys (rows) in the table and do all the calculation for each one and then store/print the cumulative output. i'm thinking some sort of loop. something like -
$coincidencia_referencias=0;
$vectorTemporal = array();
for($i=1; $i<118; $i++){
$vectorTemporal[$i]=0;
the size of this array depends once more on the size of the table, so it would be ideal if this part could also be included in the global loop.
while($row = mysql_fetch_array($result))
echo $coincidencia_referencias ." numero de coincidencias <br>";
$result3 = mysql_query("SELECT * FROM legis57pan WHERE id=13");
$row = mysql_fetch_assoc($result3);
$arregloDeComisiones = array_keys($row, '1'); //busca donde las comisiones son = 1, es decir a que comisiones pertenece
print_r($arregloDeComisiones);
echo "<br>"."<br>";
this is already automatized, it recognizes which columns have value 1 for guy #13.this would have to be looped also, so that each guy gets screened this way and his coincidences added in an array for each.
foreach($arregloDeComisiones as $key => $value){
echo $value;
echo "<br>";
$result4 = mysql_query("SELECT id FROM legis57pan WHERE $value=1");
here the coincidences are added in an array, this array would have to be generated for each individual guy.
while($row = mysql_fetch_assoc($result4)) //sumar las coincidencias en orden
for($i=0;$i<116;$i++){
echo $vectorTemporal[$i];
}
this array and size would have to be looped as well.
?>
that's that, the command detects the size of the table, then analyzes each row, and generates an array that sums coincidences and has the size of the table, the end product is a square table, with as many rows and columns as the original table has rows.
oks, greetings to all, thanks,
marcos