This topic is locked

Custom page redirect to pages depending on search result

8/9/2007 5:53:05 AM
PHPRunner General questions
M
Martijn author

I'm new to phprunner and I started with an applicatie to control inventory. Sorry for my bad english I hope you understand.
To understand my problem I will give some more information what I am buiding. I know you guys don't support applications but maybe it helps explaining what I would like.
Main application:

With a scanner the barcode of a product is scanned and checked and added to the inventory database (they type the product description of the barcode doesn't exist).

If it exist I want to show the product and +1 the inventory
:Login

|

:Menu:

J
Jane 8/9/2007

Martijn,
you can do the following:

  1. create custom view on the Datasource tables
  2. check off only Barcode field on the add page for this view on the Choose fields tab
  3. add Before record added event for this view on the Events tab.

    Here is a sample code:
    global $conn;

    $strSQLExists = "select * from TableName where Barcode=".$values["Barcode"];

    $rsExists = db_query($strSQLExists,$conn);

    $data=db_fetch_array($rsExists);

    if($data)

    {

    // if record exists do something

    header("Location: TableName_view.php?editid1=".$values["Barcode"]);

    exit();

    }

    else

    {

    // if dont exist do something else

    header("Location: TableName_add.php");

    exit();

    }

    return false;

M
Martijn author 8/10/2007

It works!
Thanx Jane for the quick reply.

Martijn,

you can do the following:

  1. create custom view on the Datasource tables
  2. check off only Barcode field on the add page for this view on the Choose fields tab
  3. add Before record added event for this view on the Events tab.

    Here is a sample code: