V
V
vvmgev2015-08-18 15:14:46
PHP
vvmgev, 2015-08-18 15:14:46

Why are there no results from the database?

$result = mysql_query("SELECT * From arajin_models WHERE name LIKE '%f%' ") or die(mysql_error()); ;
$row = mysql_fetch_array($result);
print_r($row);

there is nothing if
echo $result;
then
Resource id #4

Answer the question

In order to leave comments, you need to log in

4 answer(s)
H
hooligan377, 2019-02-17
@hooligan377

Made it a little easier, found an error. May be useful to someone:

elseif(preg_match("#[a-z]+#ui", $login) && preg_match("#[а-я]+#ui", $login)) msg('Логин должен состоять только из русского или английского алфавита');

0
0xD34F, 2019-02-16
@0xD34F

Forgot the letter "yo", forgot to set the flag "u"? Try . preg_match('|^[a-zа-яё0-9]+$|ui', $login)

M
Melkij, 2015-08-18
@vvmgev

So the query returned 0 rows.
print_r(false) doesn't output anything, so it's better to use var_dump

D
Dmitry Kravchenko, 2015-08-18
@mydearfriend

Manual: the resource variable type
mysql_fetch_array will return false if the fetch from the database is empty

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question