I have a problem executing mysqli from magento. I need it to query an external db and retrive tracking information.
I added this code to a php plugin file:
$conn = new mysqli($db_server, $db_user, $db_pass, $db_name);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT `label_url` FROM tracking WHERE `tracking_carrier` = 'BRT' AND `tracking_number` = '$trackingNumber';";
$result = $conn->query($sql); ```
but when loading the page i got a 500 erro.
I then opened the php log and found
```PHP Fatal error: Uncaught Error: Class 'Plugin\Order\mysqli```
It looks like i cannot use **mysqli**
Is there any other way to query an external db with a mysql query?