I need to show only 1 id at the same time, and I need a button to go to the previous and next id , how can I do that?
And when I click “Aanpassen” I want to edit only the id, but when I click “Aanpassen” now it shows me every id. How can I fix this?
These are my codes:
Overzichtbetalingen.php
<?php include ('betalingen.php'); ?>
<!DOCTYPE html>
<html>
<head>
<title>Overzichtbetalingen</title>
<link rel="stylesheet" type="text/css" href="overzichtbetalingen.css">
</head>
<body>
<a href="index.html">Startpagina<a/>
<table>
<thead>
<tr>
<th>Naam</th>
<th>Pand</th>
<th>Datum betaling</th>
<th colspan="2">Hoe word er betaald</th>
<th>Betalingsperiode</th>
<th>Bedrag per periode</th>
</tr>
</thead>
<tbody>
<?php while ($row = mysqli_fetch_array($results)){?>
<tr>
<td><?php echo $row['Naam']?></td>
<td><?php echo $row['Pand']?></td>
<td><?php echo $row['Datum']?></td>
<td><?php echo $row['Betaling']?></td>
<td><?php echo $row['Bank']?></td>
<td><?php echo $row['Betalingsperiode']?></td>
<td><?php echo $row['Bedragperperiode']?></td>
<?php } ?>
</tr>
</tbody>
</table>
<button class="knop" onclick="window.location = ('https://mijntuintjes.000webhostapp.com/Betalingtoevoegen.php') ">Betaling toevoegen</button>
<div>
</body>
</html>
Betalingen.php
<?php session_start(); // connect to database $db = mysqli_connect("xxx","xxx","xxx","xxx"); //retrieve results $results = mysqli_query($db, "SELECT * FROM Info"); ?>
Betalingsperiode.php
<?php
//connect to database
$db = mysqli_connect("xxx","xxx","xxx","xxx");
//show results
$results = mysqli_query($db, "SELECT * FROM Info");
?>
<!doctype html>
<html>
<head>
<title>Betalingsperiode</title>
<link rel="stylesheet" type="text/css" href="Betalingsperiode.css">
</head>
<body>
<table>
<thead>
<tr>
<th>Naam</th>
<th>E-mail</th>
<th>Betalingsperiode</th>
<th>Aanpassen</th>
</tr>
<?php while ($row = mysqli_fetch_array($results)){ ?>
<tr>
<td><?php echo $row['Naam']?></td>
<td><?php echo $row['Email']?></td>
<td><?php echo $row['Betalingsperiode']?></td>
<td>
<a href="Aanpassenbetalingsperiode.php?aanpassen=><?php echo $row['id'] ?>">Aanpassen</a>
</td>
</tr>
</thead>
</table>
<table>
<thead>
<tr>
<th>Maand</th>
<th>Bedragpermaand</th>
<th>Betaald/Niet betaald</th>
</tr>
</thead>
<tbody>
<tr>
<th><?php echo $row['Januari']?></th>
<td><?php echo $row['Bedragperjan']?></td>
<td><?php echo $row['Betaaldjan']?></td>
</tr>
<tr>
<th><?php echo $row['Februari']?></th>
<td><?php echo $row['Bedragperfeb']?></td>
<td><?php echo $row['Betaaldfeb']?></td>
</tr>
<tr>
<th><?php echo $row['Maart']?></th>
<td><?php echo $row['Bedragpermaa']?></td>
<td><?php echo $row['Betaaldmaa']?></td>
</tr>
<tr>
<th><?php echo $row['April']?></th>
<td><?php echo $row['Bedragperapr']?></td>
<td><?php echo $row['Betaaldapr']?></td>
</tr>
<tr>
<th><?php echo $row['Mei']?></th>
<td><?php echo $row['Bedragpermei']?></td>
<td><?php echo $row['Betaaldmei']?></td>
</tr>
<tr>
<th><?php echo $row['Juni']?></th>
<td><?php echo $row['Bedragperjun']?></td>
<td><?php echo $row['Betaaldjun']?></td>
</tr>
<tr>
<th><?php echo $row['Juli']?></th>
<td><?php echo $row['Bedragperjul']?></td>
<td><?php echo $row['Betaaldjul']?></td>
</tr>
<tr>
<th><?php echo $row['Augustus']?></th>
<td><?php echo $row['Bedragperaug']?></td>
<td><?php echo $row['Betaaldaug']?></td>
</tr>
<tr>
<th><?php echo $row['September']?></th>
<td><?php echo $row['Bedragpersep']?></td>
<td><?php echo $row['Betaaldsep']?></td>
</tr>
<tr>
<th><?php echo $row['Oktober']?></th>
<td><?php echo $row['Bedragperokt']?></td>
<td><?php echo $row['Betaaldokt']?></td>
</tr>
<tr>
<th><?php echo $row['November']?></th>
<td><?php echo $row['Bedragpernov']?></td>
<td><?php echo $row['Betaaldnov']?></td>
</tr>
<tr>
<th><?php echo $row['December']?></th>
<td><?php echo $row['Bedragperdec']?></td>
<td><?php echo $row['Betaalddec']?></td>
</tr>
</tbody>
<?php } ?>
</table>
</body>
</html>
Updaten.php
<?php //connect with my sql $con = mysqli_connect("xxx","xxx","xxx","xxx"); // Select database mysqli_select_db($con, 'id12302950_gebruikers'); //Update Query $sql = "UPDATE Info SET Januari = '$_POST[Januari]', Bedragperjan = '$_POST[Bedragperjan]' , Betaaldjan = '$_POST[Betaaldjan]', Februari = '$_POST[Februari]', Bedragperfeb = '$_POST[Bedragperfeb]', Betaaldfeb = '$_POST[Betaaldfeb]' ,Maart = '$_POST[Maart]', Bedragpermaa = '$_POST[Bedragpermaa]',Betaaldmaa = '$_POST[Betaaldmaa]',April= '$_POST[April]', Bedragperapr = '$_POST[Bedragperapr]',Betaaldapr = '$_POST[Betaaldapr]',Mei = '$_POST[Mei]', Bedragpermei = '$_POST[Bedragpermei]',Betaaldmei = '$_POST[Betaaldmei]',Juni = '$_POST[Juni]', Bedragperjun = '$_POST[Bedragperjun]',Betaaldjun = '$_POST[Betaaldjun]',Juli = '$_POST[Juli]', Bedragperjul = '$_POST[Bedragperjul]',Betaaldjul = '$_POST[Betaaldjul]',Augustus = '$_POST[Augustus]', Bedragperaug = '$_POST[Bedragperaug]',Betaaldaug = '$_POST[Betaaldaug]', September = '$_POST[September]', Bedragpersep = '$_POST[Bedragpersep]',Betaaldsep = '$_POST[Betaaldsep]',Oktober = '$_POST[Oktober]', Bedragperokt = '$_POST[Bedragperokt]',Betaaldokt = '$_POST[Betaaldokt]',November = '$_POST[November]', Bedragpernov = '$_POST[Bedragpernov]',Betaaldnov = '$_POST[Betaaldnov]',December = '$_POST[December]', Bedragperdec = '$_POST[Bedragperdec]',Betaalddec = '$_POST[Betaalddec]' WHERE id='$_POST[id]'"; //execute the query if (!mysqli_query($con,$sql)){ echo("Error description:". mysqli_error($con)); } header('location: Betalingsperiode.php'); ?>