A little assistance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    A little assistance

    Hi guys. I'm not too good with php buh i know asking helps alot.

    for those of y'all who get wha i mean, this is what i want to do

    for example.. A form submits info to dbase and their's a part of of dbase that carries keywords which are seperated with a comma ',' .

    is there any possible way i could remove those comma's so i use the words for something useful like search tags.

    see example
    dbase brings ' hi, boy, girl, this, that, you, me, hey, why, etc, etc.'

    i remove comma's then we have like <a href="search.php?q=hi">hi</a> and so on for the others.

    i hope someone gets what i mean :-)

    #2
    i dont exactly know what you mean could you elaborate... but if u want to for example search particular columns in a table ie multiple columbs maybe. take a look at this MySQL :: MySQL 5.0 Reference Manual :: B.5.5.1 Case Sensitivity in String Searches
    Want something coded email me at sales@webnwaphost.com for a prices.




    Comment


      #3
      I hope this example makes more sense.

      $do = "select * from keywords where name = '".$name."'";
      $done = mysql_query($do) or die("error:".mysql_error());

      lets say that the above outputs something like: "hi, hey, cool, test, best download, area, create, you, this, that, me"

      as the keywords the user used for his site then i wanna strip off the comma's there then make it useful cos there might be other sites that have one or two of the keywords so user can find 'em

      after stripping off the comma's, then i can use them for search query like <a href="search.php?q=hi">hi</a> or <a href="search.php?q=hey">hey</a> etc etc.

      I just pray someone gets this one. :-)

      Comment


        #4
        Did you mean to search for: Hi, hello

        like that recommended search words ?
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          Lol okay maybe this example is better.

          you, me, this, hey, girl, boy, who!

          there are seven meaningful words above but it's in a sentence. I want to strip-off those comma's from those words so that it comes in bits (one by one) without the comma's then i link to each of them one by one and use them for search query. How do i do it?
          Last edited by youngbobby; 27.11.09, 06:46.

          Comment


            #6
            After retrieving d comma filled results use d explode function.

            PHP Code:
            $res $myql_result;
            $bits explode(',',$res);
            // outputs an array.
            //convert to link on d fly if u want
            if(count($bits) !== 0){
            foreach(
            $bits as $keyword){
            echo 
            '<a href="search.php?q='.$keyword.'>'.$keyword.'</a>';
            }
            }else{
            echo 
            "No tags.";
            }
            //hope dat helps 

            Comment


              #7
              Wow bro that was great. Thanks a bunch!

              Comment


                #8
                If dat helpd, click thanks.

                Comment


                  #9
                  Yea i used the 'Thanks' feature. It's working but i have little problem as to when user uses space like some thing like hi, test, you,

                  after i explode as you thought, i still see %20 in url for example when i want to search for test as in above. Is there any way to fix this? Thanks

                  Comment


                    #10
                    it means u have space remove the space and it will go away
                    Want something coded email me at sales@webnwaphost.com for a prices.




                    Comment


                      #11
                      Yea but i want to strip off both the space and the comma. This is what i did

                      Code:
                       
                      $res = $myql_result;
                      $b = explode(',',$res);
                      $bits = explode(' ',$b); 
                      // outputs an array.
                      //convert to link on d fly if u want
                      if(count($bits) !== 0){
                      foreach($bits as $keyword){
                      echo '<a href="search.php?q='.
                      $keyword.'>'.$keyword.'</a>';
                      }
                      }else{
                      echo "No tags.";
                      }

                      but it returned 'Array' for me

                      Comment


                        #12
                        Yes it returns an array. I said dat earlier. Replace d foreach block with:
                        PHP Code:
                        foreach($bits as $keyword){
                        $keyword str_replace(' ','',trim($keyword));
                        echo 
                        '<a href="search.php?q='.$keyword.'">'.$keyword.'</a>';

                        Comment


                          #13
                          I used thanks again. Thanks

                          Comment

                          Working...
                          X