Select LIKE not working on XAMPP with MariaDB

276
May 01, 2017, at 08:26 AM

I cannot get "LIKE %M" to work on XAMPP with MariaDB.

$sql = "SELECT * FROM mytable WHERE names LIKE 'm%' ORDER by names ASC";
$result = mysqli_query($connection, $sql) or die("Error in selecting " . 
mysqli_error($connection));

$emparray = array();
while($row = mysqli_fetch_assoc($result))
{
    $emparray[] = $row;
}
echo json_encode($emparray);

this returns a blank screen, no errors or anything.

but if i switch to something like this

$sql = "SELECT * FROM mytable WHERE names = 'SomeName' ORDER by names ASC";

it runs just fine, so I know its not a problem connecting to the DB. And I have researched through this site for the answer first, so I am pretty confident that my code is correct.

just not sure if this is a problem with XAMPP and/or MariaDB, or if I just missed something stupid.

Thanks in advance, any advice would be appreciated.

Answer 1

figured it out....

one of my names had an umlaut over the O (Ö).

I didn't realize it was there, but once I noticed it and removed it.. it worked just fine.

Rent Charter Buses Company
READ ALSO
Add domain parameter to all subroutes automatically

Add domain parameter to all subroutes automatically

I'm trying to make it so that I can have all routes inside of a group automatically use a domain parameter without having to specify it in views and whatnotHere is an example of what I am looking for

242
How to crop small image basing on big image

How to crop small image basing on big image

This is quite challenging and that's why I have come here for help as a last resortI have an image on my drive that am trying to crop, the image itself is much bigger but in the browser I lessened it's width to make it all visible and also I kept the image ratio size

249
PHP is preventing the rest of my page from loading properly

PHP is preventing the rest of my page from loading properly

I am coding a book store for a school projectWe started last semester with html

201
Website audio stream relay

Website audio stream relay

I have a radio station with 50 listeners limitIs there a way to fetch the streaming MP3 and feed to, for example, 100 listeners? I want in my Shoutcast server to have my website as listener, then, my website will send the MP3 streaming to more listeners

320