Forum Moderators: coopster
$query = "SELECT * FROM $action where year(d_date) like \"$year%\" ORDER BY d_date DESC LIMIT $value_of_limit, $my_limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
if ($row = mysql_fetch_array($query)) {
echo ("Record Found");
} else {
echo ("No Record Found");
}
$action is the table, d_date is a date field, and $year is input from a form, while $value_of_limit and $my_limit are computed and constant values respectively.
My question is:
1. Can I rewrite the $query = .... to .... mysql_error()); to:
$query = mysql_query("SELECT * FROM $action where year(d_date) like \"$year\" ORDER BY d_date DESC LIMIT $value_of_limit, $my_limit") or die("Error: " . mysql_error());
2. Why do I keep on getting a "No record found" even though there are indeed records on the database? But when I remove the LIMIT $value_of_limit, $my_limit, the contents are displayed.