D
D
DmitryOxi2020-11-24 21:32:36
PHP
DmitryOxi, 2020-11-24 21:32:36

Why does SELECT only return small table data?

Friends, good evening :).
Explain, prompt. How so.

I fulfill request SELECT to 1 table - all deduces.
At performance of the same request to another - it is empty.
table1 has 7 columns 2 rows
table2 has 17 columns and over 300 rows, but doesn't output even 1 (when LIMIT is 1 or WHERE `id`='1').

Connection:

$dsn = "mysql:host=$servername;dbname=$database;charset=$charset";
  $options = array(
      PDO::ATTR_ERRMODE				=> PDO::ERRMODE_EXCEPTION,
      PDO::ATTR_ORACLE_NULLS		=> PDO::NULL_EMPTY_STRING,
      PDO::ATTR_DEFAULT_FETCH_MODE	=> PDO::FETCH_ASSOC
  );
  $pdo = new PDO($dsn, $username, $password, $options);


Query to table1:
$sql = $pdo->query("SELECT * FROM `table1`");
Output: as it should, associative array.

The query in Table 2 is the same, it
$sql = $pdo->query("SELECT * FROM `table2`");

outputs
array(0) { }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-11-24
@DmitryOxi

if the query returns empty, then there is no data in the table.
if you see this data in another program, then this program is connecting to another server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question