I want to get data from sql to show as an table in my php page. Here is the code I made but it gives me the error "Invalid data source name" This is the code I made
Is there someone that can help me whit this problem?
this is where the problem is I think
try {
$conn = new PDO("odbc");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT Username, Password FROM user");
$stmt->execute();
// set the resulting array to associative
$result = $stmt->setFetchMode(PDO::FETCH_ASSOC);
foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) {
echo $v;
}
}