Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_POST['submit'])) {
- echo "Blank box. retry";
- } else {
- $tag = $_POST['submit'];
- $location="localhost";
- $username="sj";
- $password="tc6859LNf8phSMBR";
- $database="sj_xbl";
- mysql_connect($location,$username,$password);
- mysql_select_db($database) or die( "Unable to select database");
- $qtag = mysql_real_escape_string($tag);
- $to_send = explode(" ", $qtag);
- unset ($result);
- foreach ($to_send as $send_item) {
- $result[] = search($send_item);
- }
- // DEBUG: Show all matching results.
- print_r($result);
- }
- function search($stag) {
- $query="SELECT * FROM `members` WHERE `tag` LIKE '%$stag%'";
- $result=mysql_query($query);
- if(!$result) {
- die(mysql_error());
- }
- unset ($tag);
- while ($row = mysql_fetch_assoc($result)) {
- $tag[] = $row['tag'];
- }
- return $tag;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement