Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Theirs not much point me giving you the other search script because they are all about the same but on different tables
- <span class="body">
- <?php
- //get data
- $button = $_GET['submit'];
- $search = $_GET['search'];
- if(!$button) {
- header("location:index.php");
- }
- else {
- if(strlen($search)==0) {
- header("location:index.php");
- }
- else {
- include 'sql.php';
- $search_exploded = explode (" ", $search);
- foreach($search_exploded as $search_each){
- $x++;
- if($x++ ==1) {
- $construct .= "`title` LIKE '%$search_each%' OR `link` LIKE '%$search_each%'";
- }
- else {
- $construct .= "OR `desc` LIKE '%$search_each%'";
- }
- $construct = "SELECT * FROM `pages` WHERE $construct";
- $run = mysql_query($construct);
- $foundnum = mysql_num_rows($run);
- }
- }
- ?>
- <article id="page-content">
- <section>
- <hgroup>
- <h2><?php
- if ($foundnum==0)
- echo "no pages found";
- else {
- echo "you searched: <B> $search </B> $foundnum pages found <br>";
- }
- }
- ?></h2>
- <?php
- while($runrows = mysql_fetch_assoc($run)) {
- $title = $runrows['title'];
- $desc = $runrows['desc'];
- $url = $runrows['link'];
- echo "<a href='$url'><h3><b>$title</b></h3><br><h4>
- $desc<br>
- $url</h4><p></a>";
- }
- ?>
- </hgroup>
- </div>
- </span>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement