Hi i have a problem qith this select i try to import default items from my dtaabse to a select for a signup of users the error is on this line if ($result->num_rows > 0) can i do!!!?
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "gimnasio";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT idTipo de Documento,Tipo_de_Documento FROM tipo de documento";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table><tr><th>idTipo de Documento</th><th>Tipo_de_Documento</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["idTipo de Documento"]."</td><td>".$row["Tipo_de_Documento"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
<div>
<div class="form-group">
<label>Tipo de Documento:</label>
<select id="tipo_tel" class= "form-control" name="txt_utdoc">
<option value="101">CEDULA DE CIUDADANIA</option>
<?php
while($row = $result->fetch_assoc())
{
?>
<option value="<?php echo $row['idTipo de Documento']; ?>"><?php echo $row['Tipo_de_Documento']; ?></option>
<?php
}
?>
</select>
</div>
</div>