Editor::inst of PHP class returning empty data values.

Editor::inst of PHP class returning empty data values.

echo18echo18 Posts: 2Questions: 1Answers: 0
$dbdt = new Database( array(
    "type" => "Mysql",
    "pdo" => $database
    ) );
    
Editor::inst( $dbdt, 'tbl_data_table_list', 'fld_tbl_id' )
    ->fields(
        Field::inst( 'fld_seo_title' )
    )
    ->process( $_POST )
    ->debug(true)
    ->json();

The above PHP code, returns total rows in the table, but the field values of 'fld_seo_title' are empty

Not sure why. I tried the same code on your demo table and it worked. But does not work on my table.

Below is the JSON data it returns

{"data":[{"DT_RowId":"row_334","fld_seo_title":null},{"DT_RowId":"row_341","fld_seo_title":null},{"DT_RowId":"row_368","fld_seo_title":null},{"DT_RowId":"row_421","fld_seo_title":null},{"DT_RowId":"row_948","fld_seo_title":null},{"DT_RowId":"row_964","fld_seo_title":null},{"DT_RowId":"row_965","fld_seo_title":null},{"DT_RowId":"row_6","fld_seo_title":""},{"DT_RowId":"row_22","fld_seo_title":""},{"DT_RowId":"row_28","fld_seo_title":""}],"options":[],"files":[],"searchPanes":{"options":[]},"draw":1,"recordsTotal":893,"recordsFiltered":893}

Is there more settings needed in the Editor class.

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    I can only presume that the fld_seo_title is null in the database? It is an empty string in three of the rows (id's 6, 22 and 28).

    Could you put the ->debug(true) line before the process call? Then show me the JSON returned from the server please?

    Thanks,
    Allan

This discussion has been closed.