I also have them in functions, the problem seems to be within functions in classes. I finally went PDO, original commented out in the excerpts below. (So it’s now working without SC macros but would be interesting to know from you still if it works within classes for you):
class TestConversation extends BotMan\BotMan\Messages\Conversations\Conversation {
...
function __construct () {
//sc_lookup(rs, "select id from tbl"); // this was replaced with below PDO code to bypass the problem
$servername = "localhost";
$username = "myuser";
$password = "mypassword";
try {
$conn = new PDO("mysql:host=$servername;dbname=mydb", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "Connected successfully";
} catch(PDOException $e) {
//echo "Connection failed: " . $e->getMessage();
}
$sth = $conn->prepare("select id from tbl ");
$sth->execute();
$result = $sth->fetchAll();
...
}