Here is what print_r prints ($ query)

mysqli_result Object ( [current_field] => 0 [field_count] => 2 [lengths] => [num_rows] => 0 [type] => 0 ) 

I tried:

 $result = mysqli_fetch_array($query); print_r($result); 

Displays an empty string.

I need to pull the value of the company column from the table data.

Added by:

Request:

 $query = mysqli_query($db, "SELECT * FROM `company` WHERE `auto_numbers` = 'В132СВ47'"); 
  • one
    sql query is correct? Check in the mysql console. - lampa

3 answers 3

Firstly, it is not necessary, but it is advisable to choose the variable names correctly: In $ query, store the query string to the database. Something like

 SELECT * FROM table 

In $ res (from response or result) put the result, which in turn is divided into rows while ($ row = mysqli_fetch_array ($ res))

And the rest of the empty string and [num_rows] => 0 - this query to the database does not return a single line :-)

     $query = mysqli_query(... $result = $query->fetch_row(); // аналог mysql_fetch_row 

      In short, the jamb was that he did not accept Russian letters.