Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/26/2023 in all areas

  1. If you are happy to display the multiple numbers and emails as, say, comma-separated lists, then you can use GROUP_CONCAT on those columns and GROUP BY Lidnummer. SELECT lid.Lidnummer , lid.Naam , lid.Voornaam , lid.Huisnummer , lid.Postcode , postcode.Adres , postcode.Woonplaats , GROUP_CONCAT(telefoonnummers.Telefoonnummer SEPARATOR ', ') as Telefoonnummer , GROUP_CONCAT(email.Emailadres SEPARATOR ', ') as Emailadres FROM lid INNER JOIN postcode ON lid.Postcode = postcode.Postcode INNER JOIN telefoonnummers lid.Lidnummer = telefoonnummers.Lidnummer INNER JOIN email ON lid.Lidnummer = email.Lidnummer GROUP BY lid.Lidnummer; Use explicit joins and not "FROM A, B, C WHERE..." When posting code in the forum, use the <> button to create a code block and specify the code type.
    1 point
  2. Because you're only looking at and considering what the browser is doing. As I said, the redirect will work fine, just like it did when I was doing my demo to that company. The problem is that without the exit, any other code in the page after the header will still run. How much of a problem that is, depends on what that page does. In the case of the demo, that code deletes data which is very bad. If you want to try get a better understanding is to use something like curl to request your URL rather than the browser. A browser that sees a Location: header ignores any other output and just requests the new URL. Using curl, you can see the rest of the output. So request your page using curl with and without the exit and you'll see the difference. curl -ik https://example.com/yourpage.php
    1 point
  3. You need to get into the habit of calling exit; after you do a redirect with header(). Calling header does not stop the script, it will continue to run, potentially doing things you don't want it to. For example, if you had: //Redirect if not logged in. if (!isset($_SESSION['id'])){ header('Location: login.php'); } //... //Delete the selected user. $sql = 'DELETE FROM users WHERE Id=?'; $stmt=$pdo->prepare($sql); $stmt->execute([$_POST['id']]); The script will still delete the record, even if the nobody is logged in, because you didn't exit;.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.