Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //SEARCH.PHP PAGE FOR SEARCHING DATABASE OF BLUEPRINTS.
- $db_name="evedump"; #This is the eve data dump database
- $db_user="root"; #This is your mysql username
- $db_pass="password"; #Mysql password for the user
- $db_host="localhost"; #your mysql host address
- $error = "Connection Problem, Check settings and retry.";
- mysql_connect($db_host,$db_user,$db_pass) or Die($error);
- $search=$_POST['search'];
- $submit =$_POST['submit'];
- #check for eve database and essential tables
- Mysql_select_db("$db_name") or die("Database may not exists or was typed incorrectly");
- //Explode search terms
- $inital_search = explode(" ",$search);
- foreach($inital_search as $search_term)
- {
- //constuct query
- $x++;
- if($x==1)
- $construct .= " typeName like '%$search_term%'";
- else
- $construct .= " or typeName like '%$search_term%'";
- }
- $construct = "Select typeName,blueprintTypeID from allbpos where $construct";
- $run = mysql_query($construct);
- $foundnum = mysql_num_rows($run);
- while($get[]=mysql_fetch_assoc($run)){
- }
- if($submit == "submit")
- {
- if($foundnum==0)
- echo "<h1>No Results Found</h1><br />";
- else
- {
- echo "$foundnum results found!<p>";
- foreach($get as $returned)
- {?>
- <a href='testing.php?id=<?=$returned['blueprintTypeID']?>'><?=$returned['typeName']?></a><br />
- <!-- TODO Paginate this search --><!--
- //TODO Add back to search
- --><?}
- }
- }
- Else
- {?>
- <form method=\"POST\" action=\"search.php\" name=\"BPlookup\"><br>
- <div style=\"text-align: center;\"><input
- maxlength=\"255\" size=\"150\" tabindex=\"1\"
- name=\"search\"><input name=\"submit\" value=\"submit\"
- type=\"submit\"><br>
- </div>
- <?}?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement