Answer the question
In order to leave comments, you need to log in
Why does sql query with Like output an empty string?
Guys tell me please, such a problem
I make a request to the database of the form: SELECT * FROM `streets` WHERE name like '%Катук%'
Everything works I write php
$q = "SELECT * FROM `streets` WHERE name like '%$b%'";
$result =mysql_fetch_array(mysql_query($q));
echo $result['name']";
Answer the question
In order to leave comments, you need to log in
MySQL does not have a FIRST() function. Instead, you can use
And move away from using mysql_ in php. use mysqli or PDO.
interesting: one request works. another request does not work. What is the question is not clear.
requests are different, there is no first() function.
What if so
echo $b;
$q = "SELECT * FROM `streets` WHERE name like '%$b%'";
$result =mysql_fetch_array(mysql_query($q));
var_dump($result);
Try to copy the query without pasting the variable and execute it i.e.
$q = "SELECT * FROM `streets` WHERE name like '%Катук%'"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question