<?php
$link = mysql_connect('localhost', 'lalala', 'lalalala');
$lacz = mysql_select_db ( 'lul' );
$limit = 10;
echo "
<center>
<a href='search.php'><img src='http://hubex.cfgfactory.pl/cmd.png' border='0'></a><br><br><br>
<form action='".$_SERVER[PHP_SELF]."' method='post'>
<input type='text' name='fraza' size='32'><br>Search in:
<input type='checkbox' name='opis'> description
<input type='checkbox' name='name'> name
<br><br><input type='image' src='bttn.jpg' />
</form>
";
if($_POST){
$query = "SELECT name,opis,sample FROM cmd WHERE name='".$_POST['fraza']."' OR opis LIKE '%".$_POST['fraza']."%'";
$result = mysql_query($query);
if(mysql_num_rows($result) < $limit){
echo '<table border="1" width="950" height="86" cellspacing="0" cellpadding="0" bordercolor="#00000" bordercolorlight="#00000" bordercolordark="#00000">
<tr>
<td height="35" width="244" align="center" valign="middle">Name</td>
<td height="35" width="408" align="center" valign="middle">Description</td>
<td height="35" width="316" align="center" valign="middle">Sample</td>
</tr>';
while($rec = mysql_fetch_assoc($result)){
echo '
<tr>
<td height="0" width="244" align="center" valign="middle">'.$rec['name'].'</td>
<td height="0" width="408" align="center" valign="middle">'.$rec['opis'].'</td>
<td height="0" width="316" align="center" valign="middle">'.$rec['sample'].'</td>
</tr>
';
}
echo '</center></table>';
}else{
echo '<br><br>Do twoich kryteriów wyszukiwania pasuje zbyt dużo wyników.';
}
}
/*$result = mysql_query("SELECT * FROM cmd");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
printf ('
<table border="1" width="950" height="150" cellspacing="0" cellpadding="0" bordercolor="#00000" bordercolorlight="#00000" bordercolordark="#00000">
<tr>
<td height="47" width="244" align="center" valign="middle">Name</td>
<td height="47" width="408" align="center" valign="middle">Description</td>
<td height="47" width="316" align="center" valign="middle">Sample</td>
</tr>
<tr>
<td height="284" width="244" align="center" valign="middle">%s</td>
<td height="284" width="408" align="center" valign="middle">%s</td>
<td height="284" width="316" align="center" valign="middle">%s</td>
</tr>
</table>', $row["name"], $row["opis"], $row["sample"]);
}
*/
?>