ckroon
Posts: 869
|
| Posted: 01/17/2008, 11:14 PM |
|
Hi All.
What is the best way to get a page to redirect if the grid on that page is empty?
I want the page to load if there are records in the grid, but if it is empty, redirect to a Thank You page.
Thanks in advance!
_________________
Walter Kempees...you are dearly missed. |
 |
 |
aondecker
Posts: 58
|
| Posted: 01/18/2008, 4:15 AM |
|
In your before show code..
$DB1 = new clsdbDATABASE_NAME;
$SQL1 = "select * from table_name;
$DB1->query($SQL1);
$RS1 = $DB1->next_record();
if (!$RS1)
{
global $Redirect;
$Redirect = YourPage.php";
}
|
 |
 |
datadoit
|
| Posted: 01/18/2008, 5:25 AM |
|
ckroon wrote:
> Hi All.
>
> What is the best way to get a page to redirect if the grid on that page is
> empty?
>
> I want the page to load if there are records in the grid, but if it is empty,
> redirect to a Thank You page.
>
> Thanks in advance!
> ---------------------------------------
In the grid's BeforeShow event:
if ($Container->ds->RecordsCount == 0) {
global $Redirect;
$Redirect = "whatever.php";
}
|
|
|
 |
ckroon
Posts: 869
|
| Posted: 01/18/2008, 7:52 AM |
|
Thanks gentlemen!
_________________
Walter Kempees...you are dearly missed. |
 |
 |
|