Jump to content

contra10

Members
  • Posts

    402
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

contra10's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Hi, I'm trying to improve my search so that it searches all words that i write in the search box and matches keywords my code right now is <?php $sub = $_GET['article']; echo "<h2>search results for: $sub</h2><br><br>"; $sub = str_replace(" ", "%", $sub); $alb = mysql_connect("localhost", "", "") or die(mysql_error()); mysql_select_db("articles") or die(mysql_error()); mysql_set_charset('utf8', $alb); $query2 = "SELECT * FROM `blog` WHERE `title` like '%$sub%'"; $result2 = mysql_query($query2) or die(mysql_error()); while ($postede2 = mysql_fetch_assoc($result2)) { $title = "{$postede2['title']}"; $author = "{$postede2['author']}"; $section = "{$postede2['section']}"; $description = "{$postede2['description']}"; $url = "{$postede2['url']}"; echo "<a href='$url'><h3><b>$title</b></h3></a><br>"; echo "By $author, Category: $section<br>"; echo "$description ...<br><br>"; } ?> How do i break down the search even further?
  2. i'm having trouble working with my search bar, when i used wamp it worked but now online i keep getting this message I placed that code for the search bar above the html tags but i keep getting the error here is my coding <?php mysql_connect("localhost", "user", "pass") or die(mysql_error()); if (isset($_POST['submit'])) { $search = mysql_real_escape_string($_POST['search']); $type = mysql_real_escape_string($_POST['type']); if ($type == true) { header("Location:http://www.link.com/searchresults.php?subdirectory=$search&type=$type"); } } ?>
  3. I don't really understand preg_match when using it, although i understand the concept i did this as a trial <?php $html = file_get_contents('http://www.google.com/'); preg_match('google', "$html", $matches); preg_match_all("<a href", $html, $match); foreach($match[1] as $val); { echo $val."<br>"; } ?> i don't really get how to get the actual a href links from all the links on the page
  4. sorry, I guess my question is: How do I create a spider that searches a website extracts links, and certain keywords, then organizes it so that it will be saved in a database?
  5. Hello, this is more of a question since I don't know where to begin. I want to use a spider to search a website and gather information and then organize it into a table the specific information from the site that I need. For example lets say I wanted to search a sports website and only get the details of the teams and their scores and then place it into my database without getting other information of that website?
  6. i did that before the data gets placed in the database, the same has to work for when im displaying it?
  7. hello, i keep getting a syntax error message when I try to display my data from my database, heres the code that i use fo veiwing the data <?php $alb = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("programs") or die(mysql_error()); mysql_set_charset('utf8', $alb); $query = "SELECT * FROM `canpro` WHERE `directory` = '$sub' ORDER BY area, school ASC"; $result = mysql_query($query) or die(mysql_error()); while ($postede = mysql_fetch_assoc($result)) { $area = "{$postede['area']}"; $dn = "{$postede['dn']}"; $dl = "{$postede['dl']}"; echo "<font size='3'><b>$school</b></font><br>"; echo "<font size='2'><b>$dn</b></font><br><font size='2' color = '#3B5998'><b>$dl</b></font><br>"; mysql_select_db("schools") or die(mysql_error()); $query2 = "SELECT * FROM `canschools` WHERE `name` = '$area'"; $result2 = mysql_query($query2) or die(mysql_error()); while ($postede2 = mysql_fetch_assoc($result2)) { $city = "{$postede2['city']}"; $area2 = "{$postede2['area']}"; echo "<font size='2'><b>$city, $area2</b></font><br><br>"; } } ?> The display message i get is it shows all my information except when the word contains an apostrohpe then it doesn't shows the error and all the information afterwords won't get displayed
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.