Query help

Discussion in 'PHP' started by neu0203, Dec 27, 2009.

  1. #1
    Hello all

    I am having truble with this code php and mysql query code below
    i ahve a table called Poreba and columns PartN, PartD, partT what i am trying to to is query PartN column (abc-741100-00168-F4) this is what I am trying to search for it comes out ok if i search for the whole thing but when I am trying to search only for couple of the numbers inside it wont work for example 74100 does not work can anyone help thank you in adavce

    $key=$_GET['key'];

    $results=mysql_query ("Select PartT FROM Poreba where MATCH (PartT) AGAMINST ('key'");
     
    neu0203, Dec 27, 2009 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $key = $_GET['key']; 
      
    $result = mysql_query ("Select `PartT` FROM `Poreba` WHERE MATCH (`PartT`) AGAINST ('$key')");
    PHP:
     
    JAY6390, Dec 27, 2009 IP
  3. neu0203

    neu0203 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    original
    $key=$_GET['key'];

    $result= mysql_query ("Select `PartN` FROM `Poreba` WHERE MATCH (`PartN`) AGAINST ('$key')"); I did change that

    echo "<table border='1' bgcolor='#F4F4F4' cell padding='1' table align='center'>";

    echo "<tr> <th>Part Number</th> <th>Part Type </th> <th>Part Description </th></tr>";
    while($row = mysql_fetch_array($result)){


    $num_rows = mysql_num_rows($result);

    however if i use

    this
    $results=mysql_query ("Select * FROM Poreba where PartN Like '%$key%'"); it works expect it does do any search within the - - statement only the last 2 digits or the whole thing
    thanks for the info
     
    neu0203, Dec 27, 2009 IP
  4. neu0203

    neu0203 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this works just fine with everything
    $key=$_GET['key'];

    $results=mysql_query ("Select * FROM Poreba WHERE PartN LIKE '%$key%' or PartDes LIKE'%$key%' or PartT LIKE '%$key%'");

    but using other search query method it doesn't show anything

    $results= mysql_query ("Select `PartN` FROM `Poreba` WHERE MATCH (`PartN`) AGAINST ('$key')");

    the match against method just wont work for me have no Idea why not
    can anyone explaint it to me thank you
     
    neu0203, Dec 27, 2009 IP