0

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;
                    }
                }
Luuk
  • 1
  • Don't post code as images. If it's relevant to the issue, copy/paste it into the question itself. If it's not relevant, then it shouldn't be added at all. – M. Eriksson Feb 10 '20 at 16:33
  • I am sorry I am pretty new to stack overflow. – Luuk Feb 10 '20 at 16:34

0 Answers0