|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-02-26 21:43 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
<?php // bug report: // note that $query gets modified by the call to // array_merge_recursive. This should not be. // // //include('../include/util.inc.php'); function dump_array ($array) { // doc // String = dump_array(Array) // returns a long string containing the array, expanded into a // nested unordered list. //statements if(is_array($array)) { echo "<ul>"; while(list($key,$val) = each($array)) { echo "<li>$key => "; if(is_array($val)) { echo "$val"; dump_array($val); } else { echo "$val"; } } echo "</ul>"; } else { if($array != "") { echo "<li>[String] = $array"; } else { echo "<li>Err: No values passed."; } } }; /* addquery example input #1 */ $query = array("select" => array( 0 => "count(*) as 'cases opened'" ), "from" => array( 0 => "table_case" ), "where" => array( 0 => "table_case.creation_time between '%datestart%' and '%dateend%'" ) ); /* example input #2 */ $option = array("select" => array( 0 => "table_bus_org.name" ), "from" => array( 0 => "table_site", 1 => "table_bus_org" ), "where" => array( 0 => "table_site.objid = table_case.case_reporter2site", 1 => "table_bus_org.objid = table_site.primary2bus_org", 2 => "table_bus_org.objid > 0" ), "group by" => array( 0 => "table_bus_org.name" ), "order by" => array( 0 => "count(*)" ) ); /* example output $newquery = array("select" => array( 0 => "table_bus_org.name", 1 => "count(*) as 'cases opened'" ), "from" => array( 0 => "table_case", 1 => "table_site", 2 => "table_bus_org" ), "where" => array( 0 => "table_case.creation_time between '%datestart%' and '%dateend%'", 1 => "table_site.objid = table_case.case_reporter2site", 2 => "table_bus_org.objid = table_site.primary2bus_org", 3 => "table_bus_org.objid > 0" ), "group by" => array( 0 => "table_bus_org.name", ), "order by" => array( 0 => "count(*)", ) ); */ dump_array($query); $newquery = array_merge_recursive($query,$option); dump_array($query); //dump_array($option); //dump_array($newquery); ?>