Mijn vraag
...ik heb een script dat werkt verder goed alleen wil ik een rij ook uit een andere tabel halen
Dus ik wil de foto_id halen uit tabel images en de naam foto_id moet file_name worden
Is dit mogelijk en zo ja wie weet hoe ?
<?php
include "dbConn.php"; // Using database connection file here
if (isset($_POST['update'])) // when click on Update button
{
$site = $_POST['site'];
$type = $_POST['type'];
$aanbod_id = $_POST['aanbod_id'];
$foto = $_POST['foto'];
$omschrijving = $_POST['omschrijving'];
$adres = $_POST['adres'];
$foto_id = $_POST['foto_id'];
$omschrijving = $_POST['omschrijving'];
$adres = $_POST['adres'];
$positie = $_POST['positie'];
$sql = "INSERT INTO `banner` (`foto_id`, `project_id`, `aanbod_id`, `site`, `foto`, `omschrijving`, `adres`, `positie`, `type`) VALUES ('$foto_id', NULL, '$aanbod_id', '$site', '$foto', '$omschrijving', '$adres', '$positie', '$type')";
$edit = mysqli_query($db, $sql);
if ($edit) {
header("location:banner.php"); // redirects to all records page
} else {
echo "Error";
}
}
?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
<title>Wijzig banner</title>
</head>
<h3>Voeg banner toe</h3>
<form method="post">
<input type="hidden" name="site" placeholder="site" value="http://Allemaal">
<input type="hidden" name="aanbod_id" value="1" placeholder="aanbod id">
<input type="text" name="foto_id" placeholder="foto id">
<input type="hidden" name="foto" value="0" placeholder="foto">
<input type="text" name="omschrijving" placeholder="omschrijving">
<input type="text" name="adres" placeholder="adres">
<input type="text" name="positie" placeholder="positie">
<input type="hidden" name="type" value="gif" placeholder="type">
<input type="submit" name="update" value="Add">
</form>
...ik heb een script dat werkt verder goed alleen wil ik een rij ook uit een andere tabel halen
Dus ik wil de foto_id halen uit tabel images en de naam foto_id moet file_name worden
Is dit mogelijk en zo ja wie weet hoe ?
<?php
include "dbConn.php"; // Using database connection file here
if (isset($_POST['update'])) // when click on Update button
{
$site = $_POST['site'];
$type = $_POST['type'];
$aanbod_id = $_POST['aanbod_id'];
$foto = $_POST['foto'];
$omschrijving = $_POST['omschrijving'];
$adres = $_POST['adres'];
$foto_id = $_POST['foto_id'];
$omschrijving = $_POST['omschrijving'];
$adres = $_POST['adres'];
$positie = $_POST['positie'];
$sql = "INSERT INTO `banner` (`foto_id`, `project_id`, `aanbod_id`, `site`, `foto`, `omschrijving`, `adres`, `positie`, `type`) VALUES ('$foto_id', NULL, '$aanbod_id', '$site', '$foto', '$omschrijving', '$adres', '$positie', '$type')";
$edit = mysqli_query($db, $sql);
if ($edit) {
header("location:banner.php"); // redirects to all records page
} else {
echo "Error";
}
}
?>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="Description" content="Enter your description here" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
<title>Wijzig banner</title>
</head>
<h3>Voeg banner toe</h3>
<form method="post">
<input type="hidden" name="site" placeholder="site" value="http://Allemaal">
<input type="hidden" name="aanbod_id" value="1" placeholder="aanbod id">
<input type="text" name="foto_id" placeholder="foto id">
<input type="hidden" name="foto" value="0" placeholder="foto">
<input type="text" name="omschrijving" placeholder="omschrijving">
<input type="text" name="adres" placeholder="adres">
<input type="text" name="positie" placeholder="positie">
<input type="hidden" name="type" value="gif" placeholder="type">
<input type="submit" name="update" value="Add">
</form>