Running shortcode with variable that is modified

I think your “do_shortcode” is not parsing the variable.

Try with this code:

echo do_shortcode('[datatable id=30 var1="'.$idnr.'"]');

* Note the ‘ before and after the .

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)