Share Pastebin
Guest
Public paste!

Hubex

By: a guest | Mar 22nd, 2010 | Syntax: PHP | Size: 2.56 KB | Hits: 70 | Expires: Never
Copy text to clipboard
  1. <?php
  2. $link = mysql_connect('localhost', 'lalala', 'lalalala');
  3. $lacz = mysql_select_db ( 'lul' );
  4.  
  5. $limit = 10;
  6.  
  7. echo "
  8. <center>
  9. <a href='search.php'><img src='http://hubex.cfgfactory.pl/cmd.png' border='0'></a><br><br><br>
  10.  
  11. <form action='".$_SERVER[PHP_SELF]."' method='post'>
  12.  
  13. <input type='text' name='fraza' size='32'><br>Search in:
  14. <input type='checkbox' name='opis'> description
  15. <input type='checkbox' name='name'> name
  16.  
  17. <br><br><input type='image' src='bttn.jpg' />
  18.  
  19. </form>
  20. ";
  21.  
  22. if($_POST){
  23.    
  24. $query = "SELECT name,opis,sample FROM cmd WHERE name='".$_POST['fraza']."' OR opis LIKE '%".$_POST['fraza']."%'";
  25. $result = mysql_query($query);
  26.  
  27. if(mysql_num_rows($result) < $limit){
  28.  
  29. echo '<table border="1" width="950" height="86" cellspacing="0" cellpadding="0" bordercolor="#00000" bordercolorlight="#00000" bordercolordark="#00000">
  30.   <tr>
  31.               <td height="35" width="244" align="center" valign="middle">Name</td>
  32.               <td height="35" width="408" align="center" valign="middle">Description</td>
  33.               <td height="35" width="316" align="center" valign="middle">Sample</td>
  34. </tr>';
  35.  
  36.         while($rec = mysql_fetch_assoc($result)){
  37.  
  38. echo '
  39. <tr>
  40.               <td height="0" width="244" align="center" valign="middle">'.$rec['name'].'</td>
  41.               <td height="0" width="408" align="center" valign="middle">'.$rec['opis'].'</td>
  42.               <td height="0" width="316" align="center" valign="middle">'.$rec['sample'].'</td>
  43.       </tr>
  44. ';
  45.  
  46. }
  47.  
  48. echo '</center></table>';
  49.  
  50. }else{
  51.  
  52. echo '<br><br>Do twoich kryteriów wyszukiwania pasuje zbyt dużo wyników.';
  53.  
  54. }
  55.  
  56. }
  57.  
  58.  
  59.  
  60.  
  61. /*$result = mysql_query("SELECT * FROM cmd");
  62.  
  63.  
  64. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  65. printf ('      
  66. <table border="1" width="950" height="150" cellspacing="0" cellpadding="0" bordercolor="#00000" bordercolorlight="#00000" bordercolordark="#00000">
  67.     <tr>
  68.                 <td height="47" width="244" align="center" valign="middle">Name</td>
  69.                 <td height="47" width="408" align="center" valign="middle">Description</td>
  70.                 <td height="47" width="316" align="center" valign="middle">Sample</td>
  71.         </tr>
  72.         <tr>
  73.                 <td height="284" width="244" align="center" valign="middle">%s</td>
  74.                 <td height="284" width="408" align="center" valign="middle">%s</td>
  75.                 <td height="284" width="316" align="center" valign="middle">%s</td>
  76.         </tr>
  77. </table>', $row["name"], $row["opis"], $row["sample"]);    
  78.  
  79. }
  80. */
  81. ?>