|
|
@@ -233,15 +233,17 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time) {
|
|
|
|
|
|
foreach($tables['X'] as $X=>$x) {
|
|
|
//rels in tbls
|
|
|
- foreach($x['rel'] as $x_rel_from=>$x_rel_to) {
|
|
|
- //echo "\n<br> #133test tbl ".$X." z_rel_fr ".$x_rel_from." to z_rel_to ".$x_rel_to." prev tbl " ;
|
|
|
- if( isset($prev_tbl['rel'][$x_rel_from]) ) { //isset($prev_dig->$prev_tbl['rel'][$x_rel_to])
|
|
|
- // echo "<br>141 rel from ".$x_rel_from." exists .. testing field ".$prev_tbl['rel'][$x_rel_from]." <br>";//strlen(".$prev_dig->$prev_tbl['rel'][$x_rel_to].")
|
|
|
-
|
|
|
- if( isset($prev_dig->$prev_tbl['rel'][$x_rel_from]) and strlen($prev_dig->$prev_tbl['rel'][$x_rel_from]) > 1 ) { //
|
|
|
- $sql_X[$X]['rel'][$x_rel_to]= $prev_dig->$prev_tbl['rel'][$x_rel_from];
|
|
|
- }
|
|
|
- }
|
|
|
+ if( isset($x['rel']) ) {
|
|
|
+ foreach($x['rel'] as $x_rel_from=>$x_rel_to) {
|
|
|
+ //echo "\n<br> #133test tbl ".$X." z_rel_fr ".$x_rel_from." to z_rel_to ".$x_rel_to." prev tbl " ;
|
|
|
+ if( isset($prev_tbl['rel'][$x_rel_from]) ) { //isset($prev_dig->$prev_tbl['rel'][$x_rel_to])
|
|
|
+ // echo "<br>141 rel from ".$x_rel_from." exists .. testing field ".$prev_tbl['rel'][$x_rel_from]." <br>";//strlen(".$prev_dig->$prev_tbl['rel'][$x_rel_to].")
|
|
|
+
|
|
|
+ if( isset($prev_dig->$prev_tbl['rel'][$x_rel_from]) and strlen($prev_dig->$prev_tbl['rel'][$x_rel_from]) > 1 ) { //
|
|
|
+ $sql_X[$X]['rel'][$x_rel_to]= $prev_dig->$prev_tbl['rel'][$x_rel_from];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//rel_like
|
|
|
foreach($x['rel_like'] as $x_rel_from=>$x_rel_to) {
|
|
|
@@ -284,7 +286,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time) {
|
|
|
$sql_x1[$T]=" select * from ".$T." where ( ";
|
|
|
foreach($rel['rel_like'] as $col=>$val) {
|
|
|
if( isset($sql_x1_str[$T])) $sql_x1_str[$T].=" or `".$col."` like '%".$val."'%" ;
|
|
|
- else $sql_x1_str[$T]=" `".$col."` = '".$val."' " ;
|
|
|
+ else $sql_x1_str[$T]=" `".$col."` like '%".$val."%' " ;
|
|
|
}
|
|
|
$sql_x1[$T].=$sql_x1_str[$T]." ) ";
|
|
|
//not loop
|