Vidi naravno da ti to nece raditi kao sto sam ti napisao.
Moras da formiras imena kolona koja pretrazujes.
evo ti neko rjesenje samo provjeri da li radi
<form action="rezultat.php" method="post">
<table width="200" border="0">
<tr>
<td align="right">Lokacija:</td>
<td>
<input type="text" name="search[lokacija]" />
</td>
</tr>
<tr>
<td align="right">Broj:</td>
<td><input type="text" name="search[broj]" /></td>
</tr>
<tr>
<td align="right">Ime:</td>
<td><input type="text" name="search[ime]" /></td>
</tr>
<tr>
<td colspan='2'> </td>
</tr>
<tr>
<td> </td>
<td align="center"><input type="submit" name='submit' value="Traži"></td>
</tr>
</table>
</form>
i
<?php
if( isset( $_POST['submit'] ) ){
foreach( $_POST['search'] as $Key => $Value )
if( $Value = !get_magic_quotes_gpc() ? addslashes(trim($Value)) : trim($Value) )
$SqlParts[] = "`$Key` LIKE '%{$Value}%'";
if( !is_array( $SqlParts ) )
die('Niste uneli sve podatke. Molimo pokušajte ponovo.');
if( !( $db = new mysqli('localhost', 'kalabrija', 'as321as0123', 'clan') ))
die('Error: Konekcija nije moguca molimo probajte kasnije.');
$Res = $db -> query( 'SELECT * FROM podaci WHERE '.implode(' AND ', $SqlParts ) );
print '<p>Pronadeno clanova: '.$Res->num_rows.'</p>';
while( $Row = $result->fetch_assoc() ){
foreach($Row as $Key => $Val)
$Row[$Key] = stripslashes($Val);
$Html.= '<b>'.(++$i).". Broj: {$Row['broj']}</b><br>";
$Html.= "Lokacija: {$Row['lokacija']}<br>";
$Html.= "Ime: {$Row['ime']}<br>";
$Html.= "Tel: {$Row['tel']}<br>";
$Html.= "Email: {$Row['email']}<br>";
}
$Res->free();
$db->close();
print "<p>{$Html}</p>";
}
?>
<A href="http://localhost/index.php">Povratak na glavnu</A>
</td></tr></table>
</body>
</html>
|