OR-Operator
|
Mit dem OR-Operator kann nach dem einen oder andern Kriterium ausgelesen werden. |
<?php
$servername = "yourservername";
$username = "yourusername";
$password = "yourpassword";
$dbname = "yourdbname";
$con = mysqli_connect($servername,$username,$password,$dbname);
$res = mysqli_query($con, "SELECT * FROM data WHERE name='Meyer' OR vorname='Hans'");
$num = mysqli_num_rows($res);
if($num > 0) echo "" ;
else echo "Keine Ergebnisse<br>";
echo "<br><table>";
while ($dsatz = mysqli_fetch_assoc($res))
{
echo "<tr>";
echo "<td>" . $dsatz["name"] . "</tD>";
echo "<td>" . $dsatz["vorname"] . "</a></tD>";
echo "<td>" . $dsatz["email"] . "</tD>";
echo "</tr>";
}
mysqli_close($con);
?> |