Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: DBI search for forward slash

by Corion (Pope)
on Nov 08, 2020 at 07:05 UTC ( #11123484=note: print w/replies, xml ) Need Help??


in reply to DBI search for forward slash

Are you certain that there is a row with the column string containing exactly /a/b/c? The database seems to think no.

What database are you using?

Does running the SQL from the console work? SELECT * FROM `texts` WHERE `string`='/a/b/c'

Replies are listed 'Best First'.
Re^2: DBI search for forward slash
by luxs (Beadle) on Nov 08, 2020 at 07:27 UTC
    Yes, phpMyAdmin returns proper line with this request. I'm using MySql with MyISAM storage.

    I can find in this table any string with one slash at the begining, but not in the middle of the string.

      But = only compares for identity. You want LIKE, and you want the % placeholder:

      SELECT * FROM `texts` WHERE `string` LIKE '%/a/b/c%'

      ... or, with placeholders:

      SELECT * FROM `texts` WHERE `string` LIKE ?

      (and then in the ->execute() call, add the placeholders to your search string)

        LIKE is fail as well

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11123484]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-05-19 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (186 votes). Check out past polls.

    Notices?