0
The code below returns database values, but the field model
only returns me the first word of the table field, the rest of the model name does not appear. What I am doing wrong?
<?php
include('conecta.php');
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT product_id, model, price FROM ocqp_product LIMIT 5";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo '<form action="" method="post">
<input type="text" name="pid" value='. $row["product_id"].' ><br>
<input type="text" name="model" value='. $row['model'].' ><br>
<input type="text" name="price" value='. $row["price"].' ><br>
</form>';
}
} else {
echo "0 results";
}
$conn->close();
Structure
All Names in inputs are repeated, do not know if this has got to be. Put the table structure
– Guilherme Nascimento
I already changed the Names, I hadn’t noticed yet thanks @Guilhermenascimento
– David Concha
*** Put the table structure [2]
– Guilherme Nascimento
put 1 or 2 lines of bank content, maybe help
– Neuber Oliveira