It's my first experience with programming and I can't solve this problem. I found code in tutorial, but it won't work for me.
List won't show data from database, but in table it all works.
My code:
<?php
$servername = "111";
$username = "1111";
$password = "111";
$dbname = "1111";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT Region_ID, Region_Name FROM Regions");
$stmt->execute();
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
echo "<select name='Choose Region'>";
foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) {
echo "<option value='" . $v['Region_Namee'] ."'>" . $v['Region_Name'] ."</option>";
}
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
$conn = null;
echo "</select>";
?>