Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl or MySQL issue
    primarykey
    data
    text
    <p>I'm trying to code a very simple MySQL SELECT query, as per attached :</p> <pre><code># # MODULES # use strict; use DBI; use DBD::mysql; # # CONNECT # my $dbd = DBI-&gt;connect("dbi:mysql:dbname=$db_name;host=$host;mysql_server_prepare=1;",$db_user, $db_pwd) or die 'No connection to dB : '.DBI::errstr; # # PREPARE # my $query = "SELECT * FROM $table WHERE $search_field = ? "; my $prep = $dbd-&gt;prepare($query) or die "ERR: " .$dbd-&gt;errstr; # # EXECUTE # $prep-&gt;execute( $search_data ) or die 'ERR : '.$prep-&gt;errstr; # # SHOW # while (my @data = $prep-&gt;fetchrow_array ) { foreach my $line (@data) { print $line.', '; } print "\n"; } </code></pre> <p>The search field with TinyText. (but tried also varchar, same result) The search field is encoded utf8_unicode_ci (but tried also latin_general_ci, same result)</p> <p>If I run the request with a number-only chain for $search_data (like 0124345): ok, I get the result<br> If I run the request with a text-only chain for $search_data (like AZERTY): ok, I get the result </p> <p>BUT:</p> <p>If I run the request with a mix text/numbers (like AZERTY01234) : No record found,<br> If I run the request with a mix text with dash, dot etc (like foo-bar): No record found<br> If I run the request with a mix text with dash, dot etc (like foo+bar): No record found</p> <p>I tried several potential fix but no success. (changing SQL data type, with and w/o simple/double quotes, no prepared query ...)</p> <p>I have no idea why and how to get it solved.</p> <p>Thx in advance for some hints.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload