CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Redirect if Grid is empty

Print topic Send  topic

Author Message
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.
View profile  Send private message
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";
}
View profile  Send private message
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.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.