I'm trying this query but I'm not able to get my results. I cant find the error! Here is my table structure:
id norm(mediumtext) bohrung(int) breite(int)
2 DIN 5462 26 6
3 DIN 5462 28 7
4 DIN 5462 32 6
5 DIN 5462 36 7
6 DIN 5462 42 8
7 DIN 5462 46 9
This is my SQL query
<?php
if (isset($_POST['bohrung'])) {
$bohrung = $_POST['bohrung'];
$result = mysqli_query ($con, "SELECT * FROM keilnaben WHERE norm = {bohrung}");
if($result && mysqli_num_rows($result) > 0) {
echo '<table class="table" border="2">
<tr>
<th>norm</th>
<th>norm</th>
<th>norm</th>
</tr>';
while($row = mysqli_fetch_array($result)) {
echo "<tr>
<td>" . $row['norm'] . "</td>
<td>" . $row['bohrung'] . "</td>
<td>" . $row['breite'] . "</td>
</tr>";
}
echo "</table>";
}
}
The problem is that when I enter for example DIN5462
in the text box, the query does not return anything, but if I try the same for bohrung
of breite
, it does return results. I don't know why.