LeonLatex Posted March 19, 2023 Share Posted March 19, 2023 Please, look at the first 2 lines. I can't find it my self. Where is the ERROR? <?php try { $pdo = new PDO('mysql:host=*****;dbame=*****'; charset=utf8', '*****','*****'); $pdo->setAttribute(PDO::ATT_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = 'SELECT' `article` FROM `articleText`'; $result = $pdo->query($sql); while ($row = $result->fetch()) { $article[] = $¤row['articleText']; } $title = 'Matsnakk'; $output = ''; foreach ($article as $article) { $output .= '<blockquote>'; $output .= '<p>'; $output .= $article; $output .= '</p>'; $output .= '</blockquote>'; } } catch (PDOException $e) { $title = 'An ERROR has occurred.'; $output = 'Database ERROR: ' . $e->getMessage() . ' in ' .$e->getFile() . ':' . $e->getLine();'; } include __DIR__ . '/../templates/layout.php'; Quote Link to comment https://forums.phpfreaks.com/topic/316020-error-in-the-first-2-lines-pdo/ Share on other sites More sharing options...
Solution kicken Posted March 19, 2023 Solution Share Posted March 19, 2023 23 minutes ago, LeonLatex said: $pdo = new PDO('mysql:host=*****;dbame=*****'; charset=utf8', '*****','*****'); Notice the highlighting error? You have an extra ' after your dbname parameter. 1 Quote Link to comment https://forums.phpfreaks.com/topic/316020-error-in-the-first-2-lines-pdo/#findComment-1606631 Share on other sites More sharing options...
LeonLatex Posted March 19, 2023 Author Share Posted March 19, 2023 Thanks Kicken Quote Link to comment https://forums.phpfreaks.com/topic/316020-error-in-the-first-2-lines-pdo/#findComment-1606632 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.