Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

HELP! Po Php Backend.

ScreamAimsFire

Proficient
Advanced Member
Messages
228
Reaction score
13
Points
38
help naman po or mabigyan nyo po ako ng idea kung pano ko gagawan ng backend itong ginagawa ko (PHP/MYSQL), bali naka gawa na po ako ng table and backend function na po sya and eto yun..
View attachment 348032
kung makikita nyo po ang table header ko ay Date, Elev, RF, Evap, Sw1 and Sw2. kung mapapansin nyo yung design ng table yung date po nya nasa gilid (left side) ngaun ang problema ko ay gusto ko sana baguhin yung design ng table at gusto ko po na maging ganito..
View attachment 348033,
Kung mapapansin nyo po for the whole month na po yung ginawa ko na table and meron akong <option> sa taas na MONTH and YEAR. nahihirapan po ako sa pag iisip ng idea kung pano ko sya gagawan ng database kung ganyang output/display ang gusto ko lumabas sa ginagawa ko. pano ko din po ididisplay yung data from mysql in that kind of table design. Sana po may makatulong sakin and makapag bigay man lang po kahit ng Idea. noob lang po kasi ako sa Php sana po may makatulong sakin TIA.
 

Attachments

  • tableold.jpg
    tableold.jpg
    45 KB · Views: 62
  • tablenew.png
    tablenew.png
    47.9 KB · Views: 58
Question: Yung nasa unang pic ba, ay yung mismong structure ng table na nasa database mo, OR translated na iyan? Paki-post yung mismong RAW data structure. I already have an answer here for a PARTICULAR structure. Kung iba ang structure mo, iba din ang query.
 
wag ka po gumamit ng dataTable, Dapat hard code yung table mo i design mo muna ng ganyan yung table mo and next mo yung pag retrieve ng data.
 
Question: Yung nasa unang pic ba, ay yung mismong structure ng table na nasa database mo, OR translated na iyan? Paki-post yung mismong RAW data structure. I already have an answer here for a PARTICULAR structure. Kung iba ang structure mo, iba din ang query.

Eto po mismo yung DB ko sa mysql sir..

View attachment 348128

- - - Updated - - -

wag ka po gumamit ng dataTable, Dapat hard code yung table mo i design mo muna ng ganyan yung table mo and next mo yung pag retrieve ng data.

Yung una ko po sir gumamit ako ng datatable pero yung gagawin ko po yung 2nd pic. hard code po na table yan.
 

Attachments

  • mysql.jpg
    mysql.jpg
    75.6 KB · Views: 20
IF you REALLY have to have a table that allows you to accomodate BOTH report types (1st - DATES as row headers, and 2nd - DATES as column headers), I'd suggest to restructure your table.

Code:
id - AutoIncrementing integer
date - as is
rTitle (or whatever column name) - for the 5 categories (elevation, rainfall, evap, sp1, sp2)
rValue (or whatever column name) - para naman sa value na ilalagay mo, to be on the safe side, use decimal na lang, instead of integer

You may use this sample table for reference
Code:
CREATE TABLE IF NOT EXISTS `testing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `rTitle` varchar(10) NOT NULL,
  `rValue` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;

--
-- Dumping data for table `testing`
--

INSERT INTO `testing` (`id`, `date`, `rTitle`, `rValue`) VALUES
(1, '2018-06-01', 'elevation', '220.00'),
(2, '2018-06-01', 'rainfall', '0.00'),
(3, '2018-06-01', 'evap', '5.00'),
(4, '2018-06-01', 'sp1', '120.00'),
(5, '2018-06-01', 'sp2', '11.00'),
(6, '2018-06-02', 'elevation', '220.00'),
(7, '2018-06-02', 'rainfall', '0.00'),
(8, '2018-06-02', 'evap', '6.00'),
(9, '2018-06-02', 'sp1', '125.00'),
(10, '2018-06-02', 'sp2', '16.00'),
(11, '2018-06-03', 'elevation', '220.00'),
(12, '2018-06-03', 'rainfall', '0.00'),
(13, '2018-06-03', 'evap', '6.00'),
(14, '2018-06-03', 'sp1', '130.00'),
(15, '2018-06-03', 'sp2', '17.00'),
(16, '2018-06-04', 'elevation', '220.00'),
(17, '2018-06-04', 'rainfall', '0.00'),
(18, '2018-06-04', 'evap', '4.00'),
(19, '2018-06-04', 'sp1', '135.00'),
(20, '2018-06-04', 'sp2', '12.00'),
(21, '2018-06-05', 'elevation', '220.00'),
(22, '2018-06-05', 'rainfall', '0.00'),
(23, '2018-06-05', 'evap', '3.00'),
(24, '2018-06-05', 'sp1', '140.00'),
(25, '2018-06-05', 'sp2', '13.00');

Code:
SELECT rTitle,
	max(case when (date="2018-06-01") then rValue else 0 end) as "2018-06-01",
    max(case when (date="2018-06-02") then rValue else 0 end) as "2018-06-02",
    max(case when (date="2018-06-03") then rValue else 0 end) as "2018-06-03",
    max(case when (date="2018-06-04") then rValue else 0 end) as "2018-06-04",
    max(case when (date="2018-06-05") then rValue else 0 end) as "2018-06-05"
FROM testing
group by rTitle
 
Last edited:
IF you REALLY have to have a table that allows you to accomodate BOTH report types (1st - DATES as row headers, and 2nd - DATES as column headers), I'd suggest to restructure your table.

Code:
id - AutoIncrementing integer
date - as is
rTitle (or whatever column name) - for the 5 categories (elevation, rainfall, evap, sp1, sp2)
rValue (or whatever column name) - para naman sa value na ilalagay mo, to be on the safe side, use decimal na lang, instead of integer

You may use this sample table for reference
Code:
CREATE TABLE IF NOT EXISTS `testing` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `rTitle` varchar(10) NOT NULL,
  `rValue` decimal(10,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;

--
-- Dumping data for table `testing`
--

INSERT INTO `testing` (`id`, `date`, `rTitle`, `rValue`) VALUES
(1, '2018-06-01', 'elevation', '220.00'),
(2, '2018-06-01', 'rainfall', '0.00'),
(3, '2018-06-01', 'evap', '5.00'),
(4, '2018-06-01', 'sp1', '120.00'),
(5, '2018-06-01', 'sp2', '11.00'),
(6, '2018-06-02', 'elevation', '220.00'),
(7, '2018-06-02', 'rainfall', '0.00'),
(8, '2018-06-02', 'evap', '6.00'),
(9, '2018-06-02', 'sp1', '125.00'),
(10, '2018-06-02', 'sp2', '16.00'),
(11, '2018-06-03', 'elevation', '220.00'),
(12, '2018-06-03', 'rainfall', '0.00'),
(13, '2018-06-03', 'evap', '6.00'),
(14, '2018-06-03', 'sp1', '130.00'),
(15, '2018-06-03', 'sp2', '17.00'),
(16, '2018-06-04', 'elevation', '220.00'),
(17, '2018-06-04', 'rainfall', '0.00'),
(18, '2018-06-04', 'evap', '4.00'),
(19, '2018-06-04', 'sp1', '135.00'),
(20, '2018-06-04', 'sp2', '12.00'),
(21, '2018-06-05', 'elevation', '220.00'),
(22, '2018-06-05', 'rainfall', '0.00'),
(23, '2018-06-05', 'evap', '3.00'),
(24, '2018-06-05', 'sp1', '140.00'),
(25, '2018-06-05', 'sp2', '13.00');

Code:
SELECT rTitle,
	max(case when (date="2018-06-01") then rValue else 0 end) as "2018-06-01",
    max(case when (date="2018-06-02") then rValue else 0 end) as "2018-06-02",
    max(case when (date="2018-06-03") then rValue else 0 end) as "2018-06-03",
    max(case when (date="2018-06-04") then rValue else 0 end) as "2018-06-04",
    max(case when (date="2018-06-05") then rValue else 0 end) as "2018-06-05"
FROM testing
group by rTitle

Actually sir yung second table po ideal design ko pa lang po yun and wala pa sya totally backend such as crud function, pwede po sir pa attach po yung mismong actual file that i can import to my db, and yung php files kung okay lang po? Para mapag aralan ko pong mabuti yung code and yunv logic behind it. Please, isa pong malaking tulong sakin yun. Thanks po marami.
 
copy and paste mo sa phpmyadmin yung nasa 2nd code block sa reply ko para makita mo yung sinasabi ko na sample table. Magcreate na yan ng table structure based dun sa ini-explain ko. Kapag created na yung table, copy and paste mo yung nasa 3rd code block para makita mo yung result ng query
 
copy and paste mo sa phpmyadmin yung nasa 2nd code block sa reply ko para makita mo yung sinasabi ko na sample table. Magcreate na yan ng table structure based dun sa ini-explain ko. Kapag created na yung table, copy and paste mo yung nasa 3rd code block para makita mo yung result ng query

Sir pano ko po maiioutput sa html table..View attachment 348034 ko po ito using php? magiging accuarate ba sya na papasok for each date sa bawat month? and pano po yung magiging function nung Dropdown option ko na DATE and YEAR?
 

Attachments

  • tablenew.png
    tablenew.png
    47.9 KB · Views: 4
sa totoo lang, tinatamad ako mag-code sa bahay. so instead na magbigay ako ng code, pseudocode na lang.

1. lagyan mo ng submit button yung select box mo. yun ang magha-handle ng submit function mo para ma-capture kung ano ang month/year na pinili mo.
2. Upon submission, pwede mo na i-concatenate ang month and year mo para magamit mo as query parameter.
3. Use the month and year to the last day ng month mo. Cases nito ay baka may addingitional day for february.
4. Use your starting day and ending day for the month as your loop to create the columns that you need for the table
5. Use nested loops to to fetch data from your table, and to plot it cell by cell
 
Hi! Pwede po sumagot?

Pwede po ninyong gamitin old table ninyo using Pivot sa SQL tutal apat lang naman yata na rows 'yung ididisplay ninyo.

Here's the script sa SQL.
Code:
Select 'elevation' Item,
		SUM(d2)d2, 
		SUM(d4)d4,
		SUM(d5)d5, 
		SUM(d6)d6, 
		SUM(d9)d9
    From(Select 'd' + Convert(varchar,DatePart(d, [date])) daynum, elevation
			from temptable)A
    PIVOT(
        SUM(elevation) For daynum IN (d2, d4, d5, d6, d9)
    )P
Union All
Select 'rainfall' Item,
		SUM(d2)d2, 
		SUM(d4)d4,
		SUM(d5)d5, 
		SUM(d6)d6, 
		SUM(d9)d9
    From(Select 'd' + Convert(varchar,DatePart(d, [date])) daynum, rainfall
			from temptable)A
    PIVOT(
        SUM(rainfall) For daynum IN (d2, d4, d5, d6, d9)
    )P
Union All
Select 'evap' Item,
		SUM(d2)d2, 
		SUM(d4)d4,
		SUM(d5)d5, 
		SUM(d6)d6, 
		SUM(d9)d9
    From(Select 'd' + Convert(varchar,DatePart(d, [date])) daynum, evap
			from temptable)A
    PIVOT(
        SUM(evap) For daynum IN (d2, d4, d5, d6, d9)
    )P
Union All
Select 'sp1' Item,
		SUM(d2)d2, 
		SUM(d4)d4,
		SUM(d5)d5, 
		SUM(d6)d6, 
		SUM(d9)d9
    From(Select 'd' + Convert(varchar,DatePart(d, [date])) daynum, sp1
			from temptable)A
    PIVOT(
        SUM(sp1) For daynum IN (d2, d4, d5, d6, d9)
    )P
Union All
Select 'sp2' Item,
		SUM(d2)d2, 
		SUM(d4)d4,
		SUM(d5)d5, 
		SUM(d6)d6, 
		SUM(d9)d9
    From(Select 'd' + Convert(varchar,DatePart(d, [date])) daynum, sp2  
			from temptable)A
    PIVOT(
        SUM(sp2) For daynum IN (d2, d4, d5, d6, d9)
    )P

and here's the output:
View attachment 348203

'yung filter mo po ng month at year, icall mo na lang sa main table, sample:
View attachment 348204
 

Attachments

  • horizontal dates.JPG
    horizontal dates.JPG
    22.5 KB · Views: 9
  • filtering.JPG
    filtering.JPG
    31.9 KB · Views: 6
sa totoo lang, tinatamad ako mag-code sa bahay. so instead na magbigay ako ng code, pseudocode na lang.

1. lagyan mo ng submit button yung select box mo. yun ang magha-handle ng submit function mo para ma-capture kung ano ang month/year na pinili mo.
2. Upon submission, pwede mo na i-concatenate ang month and year mo para magamit mo as query parameter.
3. Use the month and year to the last day ng month mo. Cases nito ay baka may addingitional day for february.
4. Use your starting day and ending day for the month as your loop to create the columns that you need for the table
5. Use nested loops to to fetch data from your table, and to plot it cell by cell

Pasensya na po sir number 1 lang po yung nagawa ko :( View attachment 348256 and yung connection sa db, diko pa po alam kung pano ko i coconcatenate yung month and year pasensya na po sir. diko pa magawa yung the rest kasi sa totoo lang wala po ako idea kung pano ko po gagawin yung gusto nyo po ipa gawa.
 

Attachments

  • tablenew1.png
    tablenew1.png
    56.7 KB · Views: 1
help naman po or mabigyan nyo po ako ng idea kung pano ko gagawan ng backend itong ginagawa ko (PHP/MYSQL), bali naka gawa na po ako ng table and backend function na po sya and eto yun..
View attachment 1264688
kung makikita nyo po ang table header ko ay Date, Elev, RF, Evap, Sw1 and Sw2. kung mapapansin nyo yung design ng table yung date po nya nasa gilid (left side) ngaun ang problema ko ay gusto ko sana baguhin yung design ng table at gusto ko po na maging ganito..
View attachment 1264689,
Kung mapapansin nyo po for the whole month na po yung ginawa ko na table and meron akong <option> sa taas na MONTH and YEAR. nahihirapan po ako sa pag iisip ng idea kung pano ko sya gagawan ng database kung ganyang output/display ang gusto ko lumabas sa ginagawa ko. pano ko din po ididisplay yung data from mysql in that kind of table design. Sana po may makatulong sakin and makapag bigay man lang po kahit ng Idea. noob lang po kasi ako sa Php sana po may makatulong sakin TIA.

nasagutan na ba to?
 
Check this sample output.
View attachment 348335

Using the table structure that I proposed, ito ang script na gagamitin mo to produce the output above.

Code:
[COLOR="#008000"]//include mo na lang yung current connection string mo[/COLOR]
<?php include('includes/connect_gb.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<style type="text/css">
		#tempTable{ font: 10px Arial, Helvetica; }
		.valueColumns{ width: 60px; text-align: center; }
		.nums{ text-align: right; }
	</style>
</head>
<body>

	<form action="" method="post">

		<select name="month" id="month">
			<?php
				[COLOR="#008000"]// generate start and end MONTH, wala ka na babaguhin dito. Naka-sticky na din yung value dito, para kapag nagsubmit ka ng value, yun pa din ang idi-display nya sa select box[/COLOR]
				$startDate = '2018-01-01'; $endDate = '20181201';
				for($x = $startDate; $x <= $endDate;){
					$selected = '';
					$month = date('M', strtotime($x)); $value = date('n', strtotime($x));
					if(isset($_POST['month'])){ $selected = ($_POST['month'] == $value) ? 'selected' : ''; }
					echo '<option value="' . $value . '" ' . $selected . '>' . $month . '</option>';
					$x = date('Y-m-01', strtotime('+1 month', strtotime($x)));
				}
			?>
		</select>

		<select name="year" id="year">
			<?php
				[COLOR="#008000"]// generates the start and end YEAR. Palitan mo na lang kung ano ang earliest date, matic na this year ang end YEAR. Also, same as above, naka sticky na din ang selected value dito[/COLOR]
				$startYear = '2010-01-01'; $endYear = date('Y-01-01');
				for($x = $startYear; $x <= $endYear;){
					$selected = '';
					$value = date('Y', strtotime($x));
					if(isset($_POST['year'])){ $selected = ($_POST['year'] == $value) ? 'selected' : ''; }
					echo '<option value="' . $value . '" ' . $selected . '>' . $value . '</option>';
					$x = date('Y-01-01', strtotime('+1 year', strtotime($x)));
				}
			?>
		</select>
		
		[COLOR="#008000"]// submit button. self-explanatory[/COLOR]
		<button name="submitted">Submit</button>
	
	</form>
	
	<?php
		[COLOR="#008000"]// para hindi agad mag-fire ang script until mag-click ka sa submit button[/COLOR]
		if(isset($_POST['submitted'])){
			$getDate = $_POST['year'] . '-' . str_pad($_POST['month'], 2, "0", STR_PAD_LEFT); [COLOR="#008000"]// concatenate the selected value (ie. 2018-06), gagamitin to as parameter sa query[/COLOR]
			$startDate = $getDate . '-01'; $endDate = date('Y-m-t', strtotime($startDate)); [COLOR="#008000"]// get the starting and ending date (ie. 2018-06-01 to 2018-06-30), gagamitin ito to generate the column headers pati na din yung required number of columns based dun sa number of days for a particular month / year.[/COLOR]
			
			[COLOR="#008000"]// loop para maggenerate ng custom columns sa query[/COLOR]
			$temp = array();
			for($x = $startDate; $x <= $endDate;){
				$rTitle = date('d', strtotime($x));
				$temp[] = 'max(case when (date="' . $x . '") then rValue else 0 end) as "' . $rTitle . '"';
				$x = date('Y-m-d', strtotime('+1 day', strtotime($x)));
			}
			$dayCol = implode(', ', $temp); [COLOR="#008000"]// gather the generated columns para mai-singit na sa query[/COLOR]
			
			echo '<table id="tempTable" border="1" cellpadding="1" cellspacing="1">';
				echo '<tr>';
					echo '<td>Date</td>';
					[COLOR="#008000"]// use the same loop as above, para magkaroon ka ng column headings sa table mo[/COLOR]
					for($x = $startDate; $x <= $endDate;){
						$disp = date('d', strtotime($x));
						echo '<td class="valueColumns">' . $disp . '</td>';
						$x = date('Y-m-d', strtotime('+1 day', strtotime($x)));
					}
				echo '</tr>';
				[COLOR="#008000"]// The actual query[/COLOR]
				$query = 'SELECT rTitle, ' . $dayCol . ' FROM testing where date like "' . $getDate . '%" group by rTitle';
				$sth = $dbc->query($query);
				while($rows = $sth->fetch(PDO::FETCH_ASSOC)){
					echo '<tr>';
						echo '<td>' . $rows['rTitle'] . '</td>'; [COLOR="#008000"]// ito yung row headings (ie. elevation, evaporation, rainfall, etc.)[/COLOR]
						for($x = $startDate; $x <= $endDate;){
							[COLOR="#008000"]// create columns based on the contents gathered sa query[/COLOR]
							$rTitle = date('d', strtotime($x));
							echo '<td class="nums">' . $rows[$rTitle] . '</td>';
							$x = date('Y-m-d', strtotime('+1 day', strtotime($x)));
						}
					echo '</tr>';
				}			
			echo '</table>';
		}
	?>

</body>

</html>
 

Attachments

  • samp.png
    samp.png
    14.3 KB · Views: 12
table design lang po problem mo aralin mo lng ung table row, table data at table head or <th>,<tr>,<td> kahit gumamit kapa ng data table pwede yn
 
Sir may kasama kasing db at kailangan din baguhin yung table format nya sa database. Sana nga po sir ganun lang ka dali na sa table lang kailangan ayusin.
 
ano na balita dito

Wait lang po sir pauwi pa lang ako ng bahay excited na nga ako i try e , thank you so much sir post po agad ako pag may na encounter akong prOb. Thanks Godbless &#55357;&#56842;

- - - Updated - - -

Check this sample output.
View attachment 1265226

Using the table structure that I proposed, ito ang script na gagamitin mo to produce the output above.

Code:
[COLOR="#008000"]//include mo na lang yung current connection string mo[/COLOR]
<?php include('includes/connect_gb.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<style type="text/css">
		#tempTable{ font: 10px Arial, Helvetica; }
		.valueColumns{ width: 60px; text-align: center; }
		.nums{ text-align: right; }
	</style>
</head>
<body>

	<form action="" method="post">

		<select name="month" id="month">
			<?php
				[COLOR="#008000"]// generate start and end MONTH, wala ka na babaguhin dito. Naka-sticky na din yung value dito, para kapag nagsubmit ka ng value, yun pa din ang idi-display nya sa select box[/COLOR]
				$startDate = '2018-01-01'; $endDate = '20181201';
				for($x = $startDate; $x <= $endDate;){
					$selected = '';
					$month = date('M', strtotime($x)); $value = date('n', strtotime($x));
					if(isset($_POST['month'])){ $selected = ($_POST['month'] == $value) ? 'selected' : ''; }
					echo '<option value="' . $value . '" ' . $selected . '>' . $month . '</option>';
					$x = date('Y-m-01', strtotime('+1 month', strtotime($x)));
				}
			?>
		</select>

		<select name="year" id="year">
			<?php
				[COLOR="#008000"]// generates the start and end YEAR. Palitan mo na lang kung ano ang earliest date, matic na this year ang end YEAR. Also, same as above, naka sticky na din ang selected value dito[/COLOR]
				$startYear = '2010-01-01'; $endYear = date('Y-01-01');
				for($x = $startYear; $x <= $endYear;){
					$selected = '';
					$value = date('Y', strtotime($x));
					if(isset($_POST['year'])){ $selected = ($_POST['year'] == $value) ? 'selected' : ''; }
					echo '<option value="' . $value . '" ' . $selected . '>' . $value . '</option>';
					$x = date('Y-01-01', strtotime('+1 year', strtotime($x)));
				}
			?>
		</select>
		
		[COLOR="#008000"]// submit button. self-explanatory[/COLOR]
		<button name="submitted">Submit</button>
	
	</form>
	
	<?php
		[COLOR="#008000"]// para hindi agad mag-fire ang script until mag-click ka sa submit button[/COLOR]
		if(isset($_POST['submitted'])){
			$getDate = $_POST['year'] . '-' . str_pad($_POST['month'], 2, "0", STR_PAD_LEFT); [COLOR="#008000"]// concatenate the selected value (ie. 2018-06), gagamitin to as parameter sa query[/COLOR]
			$startDate = $getDate . '-01'; $endDate = date('Y-m-t', strtotime($startDate)); [COLOR="#008000"]// get the starting and ending date (ie. 2018-06-01 to 2018-06-30), gagamitin ito to generate the column headers pati na din yung required number of columns based dun sa number of days for a particular month / year.[/COLOR]
			
			[COLOR="#008000"]// loop para maggenerate ng custom columns sa query[/COLOR]
			$temp = array();
			for($x = $startDate; $x <= $endDate;){
				$rTitle = date('d', strtotime($x));
				$temp[] = 'max(case when (date="' . $x . '") then rValue else 0 end) as "' . $rTitle . '"';
				$x = date('Y-m-d', strtotime('+1 day', strtotime($x)));
			}
			$dayCol = implode(', ', $temp); [COLOR="#008000"]// gather the generated columns para mai-singit na sa query[/COLOR]
			
			echo '<table id="tempTable" border="1" cellpadding="1" cellspacing="1">';
				echo '<tr>';
					echo '<td>Date</td>';
					[COLOR="#008000"]// use the same loop as above, para magkaroon ka ng column headings sa table mo[/COLOR]
					for($x = $startDate; $x <= $endDate;){
						$disp = date('d', strtotime($x));
						echo '<td class="valueColumns">' . $disp . '</td>';
						$x = date('Y-m-d', strtotime('+1 day', strtotime($x)));
					}
				echo '</tr>';
				[COLOR="#008000"]// The actual query[/COLOR]
				$query = 'SELECT rTitle, ' . $dayCol . ' FROM testing where date like "' . $getDate . '%" group by rTitle';
				$sth = $dbc->query($query);
				while($rows = $sth->fetch(PDO::FETCH_ASSOC)){
					echo '<tr>';
						echo '<td>' . $rows['rTitle'] . '</td>'; [COLOR="#008000"]// ito yung row headings (ie. elevation, evaporation, rainfall, etc.)[/COLOR]
						for($x = $startDate; $x <= $endDate;){
							[COLOR="#008000"]// create columns based on the contents gathered sa query[/COLOR]
							$rTitle = date('d', strtotime($x));
							echo '<td class="nums">' . $rows[$rTitle] . '</td>';
							$x = date('Y-m-d', strtotime('+1 day', strtotime($x)));
						}
					echo '</tr>';
				}			
			echo '</table>';
		}
	?>

</body>

</html>

Sir may error po ako eto po...
View attachment 348380
and eto po yung line code error..
View attachment 348381
 

Attachments

  • err.png
    err.png
    11.3 KB · Views: 4
  • code.png
    code.png
    40.8 KB · Views: 6
check mo jan sa class mo. Di kasi ako OOP. As is, gumagana yan.
 
Last edited:
Back
Top Bottom