LIKE ???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    LIKE ???

    Hello guys, i would need some help here...
    I am new to PHP and SQL so please, be patient!
    I have a search string which is like that:

    $searchstring=" SELECT * FROM pelatologio where pelatologio.nam e LIKE
    '%$name%' ;

    I get results only when the first character matches the variable...
    Well, that was a nonsense sentence....
    Lets say, the name field in the database = "Home"
    If i search "home" i get No results
    but if i search "Ho" i get results!

    As i understand, this has to do something with the capitalization. ..


    Can anyone help me?
    Thanx in advance!
    JBK


  • Thiago Macedo

    #2
    Re: LIKE ???

    On Aug 20, 5:48 pm, <j...@spotter.g rwrote:
    Hello guys, i would need some help here...
    I am new to PHP and SQL so please, be patient!
    I have a search string which is like that:
    >
    $searchstring=" SELECT * FROM pelatologio where pelatologio.nam e LIKE
    '%$name%' ;
    >
    I get results only when the first character matches the variable...
    Well, that was a nonsense sentence....
    Lets say, the name field in the database = "Home"
    If i search "home" i get No results
    but if i search "Ho" i get results!
    >
    As i understand, this has to do something with the capitalization. ..
    >
    Can anyone help me?
    Thanx in advance!
    JBK
    Yes, thats a capitalization problem.
    If you say what's your database and of which version, can help to
    solve your question.

    Comment

    • Jerry Stuckle

      #3
      Re: LIKE ???

      jbk@spotter.gr wrote:
      Hello guys, i would need some help here...
      I am new to PHP and SQL so please, be patient!
      I have a search string which is like that:
      >
      $searchstring=" SELECT * FROM pelatologio where pelatologio.nam e LIKE
      '%$name%' ;
      >
      I get results only when the first character matches the variable...
      Well, that was a nonsense sentence....
      Lets say, the name field in the database = "Home"
      If i search "home" i get No results
      but if i search "Ho" i get results!
      >
      As i understand, this has to do something with the capitalization. ..
      >
      >
      Can anyone help me?
      Thanx in advance!
      JBK
      >
      >
      >
      comp.database.m ysql is >>that-away.

      This is a PHP newsgroup (hence the 'php' in its name).

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Guest's Avatar

        #4
        Re: LIKE ???

        First of all, thanx for your replies...

        Jerry, consider having a database which already has more than 6000 entries
        which CANT be modified they have to stay like that... so it actually becomes
        more a php thing than an SQL... and i know the excistence of many SQL
        groups... but thanx anyway...

        I think now, i can make it work as i want it to!

        Thanx guys!

        Ï <jbk@spotter.gr Ýãñáøå óôï ìÞíõìá
        news:g8hvvj$2dq c$1@ulysses.noc .ntua.gr...
        Hello guys, i would need some help here...
        I am new to PHP and SQL so please, be patient!
        I have a search string which is like that:
        >
        $searchstring=" SELECT * FROM pelatologio where pelatologio.nam e LIKE
        '%$name%' ;
        >
        I get results only when the first character matches the variable...
        Well, that was a nonsense sentence....
        Lets say, the name field in the database = "Home"
        If i search "home" i get No results
        but if i search "Ho" i get results!
        >
        As i understand, this has to do something with the capitalization. ..
        >
        >
        Can anyone help me?
        Thanx in advance!
        JBK
        >

        Comment

        • Jerry Stuckle

          #5
          Re: LIKE ???

          jbk@spotter.gr wrote:
          First of all, thanx for your replies...
          >
          Jerry, consider having a database which already has more than 6000 entries
          which CANT be modified they have to stay like that... so it actually becomes
          more a php thing than an SQL... and i know the excistence of many SQL
          groups... but thanx anyway...
          >
          I think now, i can make it work as i want it to!
          >
          Thanx guys!
          >
          Ï <jbk@spotter.gr Ýãñáøå óôï ìÞíõìá
          news:g8hvvj$2dq c$1@ulysses.noc .ntua.gr...
          >Hello guys, i would need some help here...
          >I am new to PHP and SQL so please, be patient!
          >I have a search string which is like that:
          >>
          >$searchstring= "SELECT * FROM pelatologio where pelatologio.nam e LIKE
          >'%$name%' ;
          >>
          >I get results only when the first character matches the variable...
          >Well, that was a nonsense sentence....
          >Lets say, the name field in the database = "Home"
          >If i search "home" i get No results
          >but if i search "Ho" i get results!
          >>
          >As i understand, this has to do something with the capitalization. ..
          >>
          >>
          >Can anyone help me?
          >Thanx in advance!
          >JBK
          >>
          >
          >
          >
          Not in this newsgroup. Whether you can change the database or not is
          immaterial. This is not a PHP question - it is a MySQL one.

          Here's a hint for you - you're asking about a SQL statement, not PHP
          code. PHP knows nothing about SQL.

          Get in the correct newsgroup and you'll get help.

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          • Michael Fesser

            #6
            Re: LIKE ???

            ..oO(<jbk@spott er.gr>)
            >First of all, thanx for your replies...
            >
            >Jerry, consider having a database which already has more than 6000 entries
            >which CANT be modified they have to stay like that... so it actually becomes
            >more a php thing than an SQL...
            No. You can and should solve this in SQL either by fixing your query or
            your table structure. But you didn't gave enough details about your used
            DBMS and the table structure.

            Micha

            Comment

            • FutureShock

              #7
              Re: LIKE ???

              Michael Fesser wrote:
              .oO(<jbk@spotte r.gr>)
              >
              >First of all, thanx for your replies...
              >>
              >Jerry, consider having a database which already has more than 6000 entries
              >which CANT be modified they have to stay like that... so it actually becomes
              >more a php thing than an SQL...
              >
              No. You can and should solve this in SQL either by fixing your query or
              your table structure. But you didn't gave enough details about your used
              DBMS and the table structure.
              >
              Micha
              Or even better, go next door to the the SQL NG. Something like
              comp.databases. mysql IMHO

              You will get more solutions to your particular problem.

              Comment

              Working...