Announcement

Collapse
No announcement yet.

[SOLVED] PHP button - cannot use object of type ADORecordSet_mysqlt as array

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

  • [SOLVED] PHP button - cannot use object of type ADORecordSet_mysqlt as array

    I want to check something in database and then write something into it (or not).
    So I'm trying this code:

    Code:
    $check_table = 'table1';    // Table name
    $check_where = "column1 = '1'"; // Where clause
    
    // Check for record
    $check_sql = "SELECT column2, cloumn3 FROM $check_table WHERE $check_where";
    sc_select(rs, $check_sql);
    
    if (isset({rs[0][0]}))     // Row found
    {
       $other_field = {rs[0][0]};
       $other_region = {rs[0][1]};
    	
       echo "<br>found: $other_field and $other_region<br>";
    }
    else     // No row found
    {
       echo "<br>not found<br>";
    }
    And the result is this:

    Fatal error: Cannot use object of type ADORecordSet_mysqlt as array in /opt/NetMake/v7/wwwroot/scriptcase/app/test/test1/test1_form_apl.php on line 1837

    As you can see this is taken from standard SC example and of course works quite well if put in any Event.
    Using Ubuntu Linux 13.04 and SC Professional MySQL 7.1.last
    We need: good and complete documentation written in proper English

  • #2
    Use sc_lookup() instead of sc_select(). The arrays returned are quite different.

    jsb

    Comment


    • #3
      Works!
      Are you kind of Angel jsb?

      BTW - isn't it a bug anyway?
      Using Ubuntu Linux 13.04 and SC Professional MySQL 7.1.last
      We need: good and complete documentation written in proper English

      Comment


      • #4
        BTW - isn't it a bug anyway?
        no it isn't. The select returns a cursor to a record while the lookup returns an array of all values.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          If you say so I belive.
          But I can't see any reason why it shouldn't work in PHPbutton but works somewhere else.
          Whatever.
          It's great that there is a solution for it.
          Using Ubuntu Linux 13.04 and SC Professional MySQL 7.1.last
          We need: good and complete documentation written in proper English

          Comment

          Working...
          X