Announcement

Collapse
No announcement yet.

how to modify a given input in a search form?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to modify a given input in a search form?

    Hi,
    I have a search application calling a form app. In the search app users enter the number of their card and i am supposed to take only the first 11 digits of this no. If its one digit more, the database doesn't find anything and returns an error.
    I have been trying to find the right way to use 'substr()' in the "onapplicationinit" event of the search app, but it doesn't make any changes..
    Here is the code:

    " $cards = 'SUBSTR({CARD_NO},1,11)';
    $check_table = 'cards'; // Table name
    $check_where = "cards.CARD_NO = '$cards'"; // Where clause

    // Check for record
    $check_sql = 'SELECT *'
    . ' FROM ' . $check_table
    . ' WHERE ' . $check_where ;
    sc_select(dataset, $check_sql);

    if (false == {dataset})
    {
    // Error while accessing database
    }
    elseif ({dataset}->EOF)
    {
    // No record found
    }
    else
    {
    // Record found
    }"

    Note: It works fine when a number of 11 digits is given.
    What am i doing wrong??
    Thanks
    Last edited by mirela; 11-30-2012, 10:46 AM.
Working...
X