It is necessary to copy BLOB data from one table to another, but for some reason they are not transferred. They come, but for some reason they are not recorded.
while($row = mysqli_fetch_array($q)) { $sql_bx="insert into usr_files (FILENAME, FBID, TYPE, FILE) values( '".$row['FILENAME']."', '".$row['FBID']."', '".$row['TYPE']."', '".$row['FILE']."');"; mysqli_query($db_bx_link, $sql_bx); echo mysqli_error($db_bx_link); break; }
The $ row ['FILE'] contains this data.
while($row = mysqli_fetch_array($q)) { $stmt = mysqli_prepare($db_bx_link, "INSERT INTO usr_files VALUES (?, ?, ?, ?)"); mysqli_stmt_bind_param($stmt, 'sssd', $code, $language, $official, $percent); $code = $row['FILENAME']; $language = $row['FBID']; $official = $row['TYPE']; $percent = $row['FILE']; mysqli_stmt_execute($stmt); printf("%d строк вставлено.\n", mysqli_stmt_affected_rows($stmt)); break; }
Answer: 0 lines inserted
values( 'X' )
and if this X is equal to for examplexx 'abc' xx
then the final string contains extra quotes. Never substitute values directly into a query, always use prepared expressions and bind values php.net/manual/ru/mysqli-stmt.bind-param.php - Mike