Jump to content

phpnewbie770

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpnewbie770's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to create a search where users can enter part of an article title, and have it bring up all article titles with that word or words in it. My database contains very simply, a table called newslink with fields called article - the titles (to be searched), link - the urls, and other (varchar). I want it to search the article field, and display the article titles with the url. I have the majority of it straight(part of it is in french as the original creator was canadian) but my display shows ALL my articles, not just the ones from the search. Below is a portion of the code (which I believe needs corrections). Please advise. $newlink = $_POST["newslink"]; $where = " other='x' "; if ( $newslink != '' ) { $where = $where . " AND newslink='" . str_replace ( "'", "''", $newslink) . "'"; } print("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"><HTML><HEAD> "); print("<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;CHARSET=iso-8859-1\"> "); print("<META NAME=\"robots\" content=\"index,follow\"> "); print("<META NAME=\"description\" CONTENT=\"data\"> "); print("<META NAME=\"keywords\" "); print("CONTENT=\"natural,health,care,pro\"> "); print("<META NAME=\"reply-to\" CONTENT=\"gperon@kapservices.com\"> "); print("<META NAME=\"owner\" CONTENT=\"nhp\"> "); print("<META NAME=\"revisit-after\" CONTENT=\"3 days\"> "); print("<link href=\"communique.css\" rel=\"stylesheet\" type=\"text/css\"> "); print("<TITLE>Newslink Search</TITLE></HEAD>"); print("<BODY> "); //print("Powered by <b>KAP<i><font color=\"#FF0000\">"); //print("Services</font></i></b><i><font color=\"#FFFFFF\">.com</font></i><br>"); print("<center>"); print("<br><a href=\"search_submit_newslink.php\" class=\"text_label_titre\"> "); print("Click here to make another search</a><br><br>"); print("<table BORDER=\"0\" WIDTH=\"500\" "); print("cellspacing=\"1\">"); //print "SELECT * FROM newslink WHERE ".$where." ORDER BY `number` DESC "; $requete = mysql_query("SELECT * FROM newslink WHERE ".$where." ORDER BY `number` DESC "); while ($ligne = mysql_fetch_array($requete)) { if ($ligne["article"] != "" ) { print( "<br><b>Newslink: </b> <a href=\"".$ligne["link"]."\" target='_blank'> "); print( $ligne["article"] ); print( "</a>"); } } print "<br><br>";
×
×
  • 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.