Jump to content

Alyssa-Charlie

New Members
  • Posts

    3
  • Joined

  • Last visited

Alyssa-Charlie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I need to use a two-dimensional array to ensure that when you press a button three web pages automatically follow each other and return to the starting position. Each web page displays a photo with an audio file. I don't have the faintest idea where to start. This is what I have so far: <?php class mum{ VAR imgArray = new Array(); imgArray[0] = new Image(); imgArray[0].src = 'http://localhost/Inzendopdracht%204%20afbeeldingen/um-gaatopen.jpg'; imgArray[1] = new Image(); imgArray[1].src = 'http://localhost/Inzendopdracht%204%20afbeeldingen/um-open.jpg'; imgArray[5] = new Image(); imgArray[5].src = 'http://localhost/Inzendopdracht%204%20afbeeldingen/um-gaatdicht.jpg'; function nextImage(element)
  2. I have an overview of all members here. The only problem I have is that there are also members with multiple phone numbers and multiple email addresses. Actually I should run the query one by one but I can't do this. And how can I order them by Lidnummer? <!DOCTYPE html> <html> <head> <title>View Page</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> </head> <body> <div class="container"> <h2>Leden</h2> <table class="table"> <thead> <tr> <th>Lidnummer</th> <th>Naam</th> <th>Voornaam</th> <th>Adres</th> <th>Huisnummer</th> <th>Postcode</th> <th>Woonplaats</th> <th>Telefoonnummer</th> <th>Emailadres</th> <th>Action</th> </tr> </thead> <tbody> <?php require_once 'login.php'; $conn = new mysqli ($hn, $un, $pw, $db); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql= "SELECT lid.Lidnummer, lid.Naam, lid.Voornaam, lid.Huisnummer, lid.Postcode, postcode.Adres, postcode.Woonplaats, telefoonnummers.Telefoonnummer, email.Emailadres FROM lid, postcode, telefoonnummers, email WHERE lid.Postcode = postcode.Postcode AND lid.Lidnummer = email.Lidnummer"; $result = $conn->query($sql); if (!$result) die("Fatal Error"); $rows = $result->num_rows; for ($j = 0 ; $j < $rows ; ++$j) { if($result->num_rows>0) { while($row=$result->fetch_assoc()) ?> <tr> <td><?php echo $row['Lidnummer']?></td> <td><?php echo $row['Naam']?></td> <td><?php echo $row['Voornaam']?></td> <td><?php echo $row['Adres']?></td> <td><?php echo $row['Huisnummer']?></td> <td><?php echo $row['Postcode']?></td> <td><?php echo $row['Woonplaats']?></td> <td><?php echo $row['Emailadres']?></td> <td><?php echo $row['Telefoonnummers']?></td> <td><a class="btn btn-info" href="update.php?id=<?php echo $row['Lidnummer']?> ">Edit</a>&nbsp;<a class="btn btn-danger" href="verwijderleden.php?id=<?php echo $row['Lidnummer'];?> ">Delete</a></td><td> </tr> <?php } } ?> </tbody> </table> </div> </body> </html>
  3. I am making a CRUD. I get stuck at the output of the create. When creating, I have to save the data in the output, which is entered in the html form, in 3 different tables. As I have the code now, the data is only stored in the table lid and not in email and telefoonnummer. the primary key in the 3 tables is Lidnummer. <?php require_once 'login.php'; $conn = new mysqli ($hn, $un, $pw, $db); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } if(isset($_POST['submit'])) { $Naam = $_POST['Naam']; $Voornaam = $_POST['Voornaam']; $Huisnummer = $_POST['Huisnummer']; $Postcode = $_POST['Postcode']; $Telefoonnummer = $_POST['Telefoonnummer']; $Emailadres = $_POST['Emailadres']; $query = "INSERT INTO lid (Naam, Voornaam, Postcode, Huisnummer) VALUES ('$Naam', '$Voornaam','$Postcode','$Huisnummer')"; $query1 = "INSERT INTO email(Emailadres) VALUES ('$Emailadres')"; $query2 = "INSERT INTO telefoonnummers(Telefoonnummer) VALUES ('$Telefoonnummer')"; mysqli_query($conn, $query); mysqli_query($conn, $query1); mysqli_query($conn, $query2); $result = mysqli_multi_query($conn, $query); if($result) { echo "Data Inserted Successfully!"; } else { echo "Data Not Inserted!. Error: " . $query . "" . mysqli_error($conn); } } ?>
×
×
  • 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.