I'm trying to load data from a database table within my page.
this that I report below is a demonstrative example, to explain how I would like to realize it ... actually we are talking about 100 fields of the database and 1000 and passes rows of code of the table ...
<?php
$servername = "localhost";
$username = "progettocantiere";
$password = "";
$dbname = "my_progettocantiere";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$idCantiere = $_GET['idCantiere'];
$sql1 = "SELECT * FROM Cantiere WHERE idCantiere = '$idCantiere'";
$result = mysqli_query($sql1, $conn);
$details = mysqli_fetch_array($result);
$savedNomeCantiere = $details["nomeCantiere"];
$savedCodiceCommessa = $details["codiceCommessa"];
$savedIndirizzoCantiere = $details["indirizzoCantiere"];
var_dump($details);
$result1 = $conn->query($sql1);
echo($nomeCantiere);
?>
<html>
<head>
</head>
<body>
<table width="300" border="0">
<tr>
<td>Name</td>
<td><input type="text" name="savedNomeCantiere" style="text-align:right" value="<?php echo $savedNomeCantiere; ?>" /></td>
</tr>
<tr>
<td>Cost</td>
<td><input type="text" name="savedCodiceCommessa" style="text-align:right" value="<?php echo $savedCodiceCommessa; ?>" /></td>
</tr>
<tr>
<td>Cost</td>
<td><input type="text" name="savedIndirizzoCantiere" style="text-align:right" value="<?php echo $savedIndirizzoCantiere; ?>" /></td>
</tr>
</table>
<br/>
</body>
</html>
I tried with this type of upload that is putting an "echo" inside the "value" of the textbox, but it does not work .
This line is used to derive the "id" through page redirection.
$idCantiere = $_GET['idCantiere'];
if i want to try a var_dump($details)
it return NULL