Home>

Hello, there is a code

$ zapros= mysql_query ("SELECT * from table");
$ data= mysql_fetch_assoc ($ zapros);
Do {} While ($ data= mysql_fetch_assoc ($ zapros));
Do {} While ($ data= mysql_fetch_assoc ($ zapros));

2 cycle is not executed, only the first passes, what can cause? Thanks

DEPRECATED This extension is outdated, starting with the PHP 5.5.0 version, and will be deleted in the future. Use Mysqli or PDO_MYSQL instead. See also MySQL instructions: API selection and matching FAQ for more details. Alternatives for this feature: mysqli_connect () PDO :: __ CONSTRUCT ()

zb'2021-08-02 12:37:07

Thank you, but the question is how in each query mysqli_query not to open the connection from the database? mysqli_query= ($ Link, $ Query);

benjibboy2021-08-02 12:37:07

mysqli_query= ($ Link, $ Query); In this row, you do not open the connection, and refer to the already open connections for your session.

terantul2021-08-02 12:37:07
  • Answer # 1

    http://ua2.php.net/mysql_fetch_assoc. We read docks

    Returns an associative array that corresponds to the resulting row and shifts the internal indicator of the result.

    The first cycle you select all the entries and shift the pointer to the end. As a result, when you repeated call will not return anything as the pointer is at the end.

  • Answer # 2

    http://ua2.php.net/mysql_fetch_assoc. We read docks

    Returns an associative array that corresponds to the resulting row and shifts the internal indicator of the result.

    The first cycle you select all the entries and shift the pointer to the end. As a result, when you repeated call will not return anything as the pointer is at the end.