Chciałem zrobić prostą wyszukiwarkę na podstawie innych modułów, które mam.. i wyskakują mi jakies dziwne błędy..
A szukanie oczywiscie nie działa..
<form action="search_file.php" method="post"> <p>Imię:
<input type="text" name="imie" size="30" maxlength="40" style="position: absolute; left: 150px; color: gray "></p> <p>Nazwisko:
<input type="text" name="nazwisko" size="30" maxlength="40" style="position: absolute; left:150px; color: gray "></p> <p>Pesel:
<input type="text" name="pesel" size="30" maxlength="40" style="position: absolute; left:150px; color: gray "></p> <p>Lekarz:
<input type="text" name="lekarz" size="30" maxlength="40" style="position: absolute; left:150px; color: gray "></p> <p>Ilość ekspozycji:
<input type="text" name="ilosc" size="30" maxlength="40" style="position: absolute; left:150px; color: gray "></p> <p>Dawka:
<input type="text" name="dawka" size="30" maxlength="40" style="position: absolute; left:150px; color: gray "></p> <p>Uwagi:
<input type="text" name="uwagi" size="30" maxlength="40" style="position: absolute; left:150px; color: gray "></p> <p><label for="xxx"> </label> <input type="submit" name="wyslij" value="Szukaj" id="submit" class="Button" />
<?
require_once('./config.php');
$imie=trim($_POST['imie']); $nazwisko=trim($_POST['nazwisko']); $pesel=trim($_POST['pesel']); $lekarz=trim($_POST['lekarz']); $ilosc=trim($_POST['ilosc']); $dawka=trim($_POST['dawka']); $uwagi=trim($_POST['uwagi']); {
echo ("<br><br><br><br><br><br><br><br><br> <p align=\"center\"><b>Brak kryteriów wyszukiwania!</b></p><br><br><br><br><br><br>");
}
else
{
$wynik = mysql_query("SELECT * FROM `badania` WHERE `imie` LIKE "%$imie%" "); echo "<table cellpadding=\"2\" border=0 align=\"center\">"; echo "<th width=\"20px\" style=\"font-size: 10px\" align=\"left\">LP.</td>"; echo "<th width=\"60px\" style=\"font-size: 10px\" align=\"left\"><a href=\"list.php?okres=month&sort=data\">Data</a></td>"; echo "<th width=\"115px\" style=\"font-size: 10px\" align=\"left\"><a href=\"list.php?okres=month&sort=imie\">Imię</a></td>"; echo "<th width=\"120px\" style=\"font-size: 10px\" align=\"left\"><a href=\"list.php?okres=month&sort=nazwisko\">Nazwisko</a></td>"; echo "<th width=\"70px\" style=\"font-size: 10px\" align=\"left\"><a href=\"list.php?okres=month&sort=pesel\">Pesel</a></td>"; echo "<th width=\"140px\" style=\"font-size: 10px\" align=\"left\"><a href=\"list.php?okres=month&sort=lekarz\">Lekarz kierujący</a></td>"; echo "<th width=\"40px\" style=\"font-size: 10px\" align=\"left\"><a href=\"list.php?okres=month&sort=ilosc\">Ilość</a></td>"; echo "<th width=\"100px\" style=\"font-size: 10px\" align=\"left\"<a href=\"list.php?okres=month&sort=dawka\">Dawka</a></td>"; echo "<th width=\"165px\" style=\"font-size: 10px\" align=\"left\">Uwagi</td>"; echo "<th width=\"40px\" style=\"font-size: 10px\" align=\"center\">Usuń</td>"; echo "<th width=\"40px\" style=\"font-size: 10px\" align=\"center\">Edytuj</td>"; // echo( $tydzien=date("W",strtotime($r['data'])));
echo "<td style=\"font-size: 10px\">".$i++."</td>"; echo "<td style=\"font-size: 10px\">".$r['data']."</td>"; echo "<td style=\"font-size: 10px\">".$r['imie']."</td>"; echo "<td style=\"font-size: 10px\">".$r['nazwisko']."</td>"; echo "<td style=\"font-size: 10px\">".$r['pesel']."</td>"; echo "<td style=\"font-size: 10px\">".$r['lekarz']."</td>"; echo "<td style=\"font-size: 10px\">".$r['ilosc']."</td>"; echo "<td style=\"font-size: 10px\">".$r['dawka']."</td>"; echo "<td style=\"font-size: 10px\">".$r['uwagi']."</td>"; echo "<td align=\"center\"><a href=\"del.php?a=del&id={$r['id']}\"><img border='o'src='/images/usun.png'></a></td>"; echo "<td align=\"center\"><a href=\"edit.php?a=edit&id={$r['id']}\"><img border='o'src='/images/edytuj.png'></a></td>"; }
};
?>
po wyszukaniu otrzymuje..
Warning: Division by zero in search_file.php
Warning: Division by zero in search_file.php
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in search_file.php