The code below returns values from the database, however the model
field only returns me the first word of the table field, the rest of the template name does not appear. What am I 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