fansa Posted June 18, 2009 Share Posted June 18, 2009 how to make column and row to be dynamic or in array?? it refer based on data.... for example XX YY XX YY XX YY XX YY XX YY XX YY Quote Link to comment Share on other sites More sharing options...
joel24 Posted June 18, 2009 Share Posted June 18, 2009 don't entirely understand what you want? Quote Link to comment Share on other sites More sharing options...
fansa Posted June 18, 2009 Author Share Posted June 18, 2009 don't entirely understand what you want? actually i want to make like this Y YYYYYYYYY x d d d d d d d x d d d d d d d x d d d d d d d x d d d d d d d Y-is dynamic.meB will be more and meB will be only one column it based on data(d) x-also dynamic.meB will be more and meB will be only one row it based on data(d) the coading that i have done is like below..but the success is only be the row dynamic not the column...can u all help me??? <?php session_start(); if(session_is_registered('username') && session_is_registered('level')&& session_is_registered('cust_id')) { //get connection to database include('../connect.php'); //declare array $group_category=array(); $group_location=array(); $sql_1 = "select company_name from fls_customer where customer_id = '".$_SESSION['cust_id']."'"; $result1 = mysql_query($sql_1, $link); $rows1=mysql_fetch_array($result1); $com_name = $rows1['company_name']; if ($_REQUEST["mula"] != '00-00-0000'){ $startDate=$_REQUEST["mula"]; $split = explode("-", $startDate); $mula = "" . $split[2] . "-" . $split[1] . "-" . $split[0]; } if ($_REQUEST["tamat"] != '00-00-0000'){ $endDate=$_REQUEST["tamat"]; $split = explode("-", $endDate); $tamat = "" . $split[2] . "-" . $split[1] . "-" . $split[0]; } //$field1="location"; $field2="company_name"; $field3="$mula"; $field4="report_date"; $table1="fls_faultreport "; $table2="fls_product_category "; $order="location asc"; if ($_REQUEST["locate"] != 'all') { $location=" and $table1.location='".$_REQUEST["locate"]."'"; } else { $location= ""; } if ($com_name == 'Suruhanjaya Syarikat Malaysia (SSM)') { $oncategory= "$table1.category = $table2.category"; } elseif ($com_name != 'Suruhanjaya Syarikat Malaysia (SSM)') { $oncategory= "$table1.category = $table2.cat_id"; }?> <? echo "SELECT $table2.category,$table1.location FROM $table1 INNER JOIN $table2 ON $oncategory WHERE $table1.report_date between '$mula' and '$tamat' $location group by $table2.category ORDER BY $table1.$order "; $sqlselect=mysql_query("SELECT $table2.category,$table1.location FROM $table1 INNER JOIN $table2 ON $oncategory WHERE $table1.report_date between '$mula' and '$tamat' $location group by $table2.category ORDER BY $table1.$order ",$link); $j=0; while(list($cat,$loc) = mysql_fetch_row($sqlselect)) { $group_category[$j]=$cat; $group_location[$j]=$loc;?> <table> <tr> <td><strong><span class="style35"><?php echo $group_location[$j];?></span></strong></td> </tr> </table> <? $j++; }?> <?php } // end session ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.