dagger2002
Programmer
Ok All i have a hidden error. Can Any One Find it?
Here is A sample DB Row From DB:
Here is the code
The problem is is that the data is always Coming out not true. So it is always hitting the else.
The data is held in a mysql db.
The data should resemble this when done
Thanks All
Here is A sample DB Row From DB:
Code:
20 Coord Meet Min: 07-03 File Path 3 2007 03 01 20070301 21
Here is the code
Code:
<?php
################################################################################
##
## Sets Variables
$year = 1;
$compDate = $year . "0632";
$compDate2 = ($year - 1) . "0632";
##
################################################################################
?>
<?php
################################################################################
##
## Queries DB
$query = "SELECT file_id, file_name, file_path, file_type, left(file_date, 4) as file_year, right(left(file_date, 6), 2) as file_month, right(file_date, 2) as file_day, file_date as fullDate FROM `files` WHERE `file_type` = '3'
ORDER BY fullDate DESC;";
$result = mysql_query($query) or die("Couldn't Select: files");
$numRows = mysql_num_rows($result);
##
################################################################################
?>
<?php
################################################################################
##
## Start Page Setup
## If records
if($numRows > 0){
## Set Year to null
// $compareYear = 0;
## Main While Loop
while ($row = mysql_fetch_array($result)) {
if($compDate < $row[fullDate] AND $compDate2 > $row[fullDate]){
echo "<blockquote><p>" . $row[file_name] . "</p></blockquote>";
}
else{
$year = $row[file_year];
$compDate = $year . "0632";
$compDate2 = ($year - 1) . "0632";
echo "<h2>" . ($year - 1) . " / " . $year . "</h2>";
echo "<blockquote><p>" . $row[file_name] . "</p></blockquote>";
}
echo "<h3>" . $compDate . " | " . $compDate2 . " : " . $row[fullDate] . " ; " . $year . " , " . $row[file_id] . "</h3>";
}
}
else{
die("No files to view");
}
##
################################################################################
?>
The problem is is that the data is always Coming out not true. So it is always hitting the else.
The data is held in a mysql db.
The data should resemble this when done
Code:
EXAMPLE
2006 / 2007
File 1 20070601
File 2 20070505
File 3 20070201
File 4 20060710
2005 / 2006
File 5 20060604
File 6 20050710
...
Thanks All