Search string is too exact help

Thread Solved

Join Date: Oct 2009
Posts: 14
Reputation: dandixon is an unknown quantity at this point 
Solved Threads: 0
dandixon dandixon is offline Offline
Newbie Poster

Search string is too exact help

 
0
  #1
Nov 2nd, 2009
Right im very new to php and kinda learning as i go, here is my code.

What it is, is when i search a part number it has to be matching the case e.g if i search a6725 it doesnt work but if i search A6725 its returns the result.

please help!!!
  1. $qresult = mysql_query("SELECT * FROM products WHERE part = \"$pt\"");
  2. $row = mysql_fetch_array($qresult);
  3. {
  4. do
  5. {
  6. echo "<tr><td>".$row['part']."</td></tr>";
  7. echo "<tr><td>".$row['desc']."</td></tr>";
  8. echo "<tr><td>";
  9. if ($row['part'] <> $pt){
  10. echo $none;
  11. }
  12. elseif ($row['qt'] == $qty){
  13. echo $limit;
  14. }
  15. elseif ($row['qt'] >= $qty){
  16. echo $in;
  17. }
  18. elseif ($row['qt'] <= $qty){
  19. echo $out;
  20. }
  21. }
  22. while($row = mysql_fetch_array($qresult));
  23. }
  24.  
  25. echo "</table>";
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 97
Reputation: sureronald is an unknown quantity at this point 
Solved Threads: 16
sureronald sureronald is offline Offline
Junior Poster in Training
 
0
  #2
Nov 2nd, 2009
  1. $query="SELECT * FROM products WHERE part LIKE \"%$pt%\""
This will match any string in the column `part` where the substring/string contained in $pt is found
Catch me here!
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 14
Reputation: dandixon is an unknown quantity at this point 
Solved Threads: 0
dandixon dandixon is offline Offline
Newbie Poster
 
0
  #3
Nov 2nd, 2009
solved it thanks anyway used this in the form code

  1. onBlur="this.value=this.value.toUpperCase()"

to force it to search in uppercase

ta
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 258 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC