Jump to content

how to put array in array


redo

Recommended Posts

i have one problem...i got this coding and having problem to call data from database at *<?phpinclude 'charts.php';$chart[ 'axis_category' ] = array ( 'size'=>12, 'color'=>"000000", 'alpha'=>50, 'font'=>"arial", 'bold'=>true, 'skip'=>0 ,'orientation'=>"horizontal" ); $chart[ 'axis_ticks' ] = array ( 'value_ticks'=>false, 'category_ticks'=>false );$chart[ 'axis_value' ] = array ( 'alpha'=>0 );$chart[ 'chart_border' ] = array ( 'top_thickness'=>0, 'bottom_thickness'=>0, 'left_thickness'=>0, 'right_thickness'=>0 );*$chart[ 'chart_data' ] = array ( array ( "month", "july", "august", "september" ), array ( "region 1", 50, 70, 110 ) );$chart[ 'chart_grid_h' ] = array ( 'thickness'=>0 );$chart[ 'chart_pref' ] = array ( 'rotation_x'=>rand(20,40), 'rotation_y'=>rand(20,40) ); $chart[ 'chart_rect' ] = array ( 'x'=>-60, 'y'=>30, 'width'=>480, 'height'=>240, 'positive_alpha'=>0, 'negative_alpha'=>25 );$chart[ 'chart_type' ] = "3d column" ;$chart[ 'chart_value' ] = array ( 'hide_zero'=>true, 'color'=>"000000", 'alpha'=>80, 'size'=>10, 'position'=>"over", 'prefix'=>"", 'suffix'=>"", 'decimals'=>0, 'separator'=>"", 'as_percentage'=>true );$chart[ 'legend_label' ] = array ( 'layout'=>"vertical", 'font'=>"arial", 'bold'=>true, 'size'=>12, 'color'=>"000000", 'alpha'=>50 ); $chart[ 'legend_rect' ] = array ( 'x'=>50, 'y'=>35, 'width'=>100, 'height'=>40, 'margin'=>5, 'fill_color'=>"000066", 'fill_alpha'=>0, 'line_color'=>"000000", 'line_alpha'=>0, 'line_thickness'=>0 ); $chart[ 'live_update' ] = array ( 'url'=>"php/Gallery_3D_Column_1.php?time=".time(), 'delay'=>5 );$chart[ 'series_color' ] = array ("666666","768bb3" ); $chart[ 'series_gap' ] = array ( 'bar_gap'=>10, 'set_gap'=>20) ; SendChartData ( $chart );?>can someone help???i want to call the data from database

Link to comment
Share on other sites

Please post your database's table structure, the problem may be easier to solve then.

Link to comment
Share on other sites

Please post your database's table structure, the problem may be easier to solve then.
this is my database...pb_jumlah_pekerja,pb_bulan,pb_tahun,pb_id,pb_nilai_pertubuhan,pb_nilai_gaji table name basicdata_pembuatansory my atribut using malay language...
Link to comment
Share on other sites

Argh what do they mean :) lolWell, supposing you wanted to retrieve each month's values from your database, and say that you had four columns with the names "year", "july", "august", and "september" (I don't speak Malay so your table is a bit confusing for me):

<?php$con = mysql_connect("localhost","db_username","db_password"); //Connect to your databasemysql_select_db("your_dbname"); //Select the relevant database$data = array_values(mysql_fetch_assoc(mysql_query("SELECT july, august, september FROM basicdata_pembuatan WHERE year='2007'"))); //Gets the months' values from the table where the year = 2007$data = explode("region 1," . implode(",", $data)); //Appends "region 1" to the start$chart[ 'chart_data' ] = array ( array ( "month", "july", "august", "september" ), $data );?>

Link to comment
Share on other sites

Argh what do they mean :) lolWell, supposing you wanted to retrieve each month's values from your database, and say that you had four columns with the names "year", "july", "august", and "september" (I don't speak Malay so your table is a bit confusing for me):
<?php$con = mysql_connect("localhost","db_username","db_password"); //Connect to your databasemysql_select_db("your_dbname"); //Select the relevant database$data = array_values(mysql_fetch_assoc(mysql_query("SELECT july, august, september FROM basicdata_pembuatan WHERE year='2007'"))); //Gets the months' values from the table where the year = 2007$data = explode("region 1," . implode(",", $data)); //Appends "region 1" to the start$chart[ 'chart_data' ] = array ( array ( "month", "july", "august", "september" ), $data );?>

sory...this is my table pb_month,pb_year,pb_number_worker from basicdata_pembuatan$chart[ 'chart_data' ] = array ( array ( "month", "july", "august", "september" ), $data );maybe i could do like this???$chart[ 'chart_data' ] = array ( array ( "month", "$data" ); i want to call data from my database based on year that user choose...which mean i dunno how many month involve in that year...i really hope u understand wut i tryin to say...plz help me...i really need ur help
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...