Forums

Search records by date

buckrobbie80 07 Mar, 2011
I have a form and at the top is a dropdown to select the month created with the wizard and one to select the day then a text box for the year yyyy I was doing this so I could filter the forms by month and eventually year on the front end in chrono connectivity to only show records by the currently logged in user containing the month chosen by the user he could view all of his daily/weekly records by month to make it easier to review years/months later I was trying to follow the chrono connectivity tutorials my header code is:
<?php
$style = "";
$style .= "
table.cf_listing {
margin-bottom: 12px;
}
";
if ( $style) {
$doc =& JFactory::getDocument();
$doc->addStyleDeclaration($style);
}
?>
<table class='cf_listing'>
<thead>
<tr>
<th>Name</th><th>Email</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan='2' style='height:4px; background:silver;'></td>
</tr>
</tfoot>
<tbody>
and my body code is:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title></title>
</head>
<body>
<table style="text-align: left; width: 607px; height: 51px;"
 border="0" cellpadding="2" cellspacing="4">
  <tbody>
    <tr>
      <td
 style="font-family: Helvetica,Arial,sans-serif; text-align: left; color: rgb(99, 139, 198); font-weight: bold; background-color: rgb(237, 239, 244); width: 231px;"><span
 style="font-weight: normal;"> </span><big
 style="font-weight: normal;"> Date:</big>  <span
 style="color: black; font-weight: normal;">{text_3} </span><span
 style="color: black; font-weight: normal;">{text_5}, </span><span
 style="color: black; font-weight: normal;">{text_4}</span></td>
      <td
 style="color: rgb(99, 139, 198); background-color: rgb(237, 239, 244); width: 140px;"><span
 style="font-family: Helvetica,Arial,sans-serif; font-weight: bold;"> </span><span
 style="font-family: Helvetica,Arial,sans-serif;"> <big>Topic</big></span><big>:</big><span
 style="font-weight: bold;">  </span><span
 style="color: black; font-family: Helvetica,Arial,sans-serif;">{text_1}</span></td>
      <td
 style="text-align: center; background-color: rgb(237, 239, 244); width: 101px;">{edit_record}</td>
      <td
 style="text-align: center; background-color: rgb(237, 239, 244);">{delete_record}</td>
    </tr>
  </tbody>
</table>
<br>
and my where sql code is:
<?php
$user =& JFactory::getUser();
echo "WHERE `cf_user_id` = ".$user->id;
?>
$filter_catid =& JRequest::getInt('filter_catid', 0, 'post');
if ( $filter_catid ) {
echo " WHERE `catid` LIKE '$filter_catid' ";
}

I just get error messages what am I doing wrong I tried to follow the tutorials and adapt them to my needs. Is ther a better way to do this like with the date picker or something I want to show the user when they created something and let them sort by when they created it (month and year)

Thanks for your help,
Robert

p.s. the edit and delete button images should be and where being pulled up by image code in the edit and delete link code boxes
GreyHead 07 Mar, 2011
Hi Robert,

You don't say what error message syou are getting which makes the diagnosis a bit shot-gun. Here are the main things I noticed:
[list]
  • There is no form code in the header section to filter the results, Presumably you haven't got that far.

  • The body box has got HTML header tags in it which certainly don't belong. All that should be in here is the <tr> . . . </tr> chunk (no <table> or <tbody> tags either).

  • The WHERE box code uses the results of the filter_catid input but (see above) there is no such input in the header box.

  • The WHERE box also has two echo "WHERE . . ." lines - having two will break the MySQL query. They need to be combined into a single echo "WHERE . . . " statement using the $where array approach in the tutorials.
  • [/list]

    Bob
    This topic is locked and no more replies can be posted.