podsyłam code
<?php if($_GET['podstrona']=='authors'){ ?> <h1>AUTHOR's</h1> <?php $query = $pdo->prepare("INSERT INTO author (first_name, last_name, year_of_birth) VALUES (:first_name, :last_name, :year_of_birth)"); $query->execute( array(':first_name'=>$_POST['first_name'], ':last_name'=>$_POST['last_name'], ':year_of_birth'=>$_POST['year_of_birth']) ); } if ($pdo->lastInsertId()){ echo 'Dodadno nowego autora: <b>'.$_POST['first_name'].' '.$_POST['last_name'].'</b> urodzonego dnia '.$_POST['year_of_birth']; } else { } } ?> <form method="post"> <table> <tr> <td><input type="text" name="first_name" id="first_name" placeholder="first_name" <td><input type='text' name="last_name" id="last_name" maxlength="45" placeholder="last_name" <td><input type="text" name="year_of_birth" id="year_of_birth" placeholder="year_of_birth" <td><button type="submit" id="insertAuthor" name="insertAuthor">ADD!</button></td> </tr> <?php exit; $stmt = $pdo->query('SELECT * FROM author'); foreach($stmt as $row){ ?> <tr> <td><input type='text' name='first_name' id='first_name' value='<?php echo $row['first_name']; ?>' maxlength='45' /><br /></td> <td><input type='text' name='last_name' id='last_name' value='<?php echo $row['last_name']; ?>' maxlenght='45' /><br /></td> <td><input type='text' name='year_of_birth' id='year_of_birth' value='<?php echo $row['year_of_birth']; ?>' /><br /></td> <td> </td> </tr> <?php } $stmt->closeCursor(); ?> </table>
tam gdzie jest exit; działa wszystko ok dodaje półki wyświetla błąd itd ale nie ma odczytu z bazy danych wiadom. jak opuszczę exit to dodaje mi tylko ostatnio pis z bazy za każdym razem