search

Home  >  Q&A  >  body text

There is no mysql_field_name in php7. How to get the attribute name specified in the mysql result set?

mysqli_field_name($result,2); //email
I did not find a replacement function for mysql_field_name in php7. How can I achieve the same effect?
Thank you~

仅有的幸福仅有的幸福2827 days ago1185

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 13:08:16

    php7 canceled support for mysql extension

    If you use mysqli, you can write like this

    <?php
        $link = mysqli_connect('localhost', 'root', '', 'test');
        $result = $link->query('select * from jobs');
    
        echo $result->fetch_field_direct(0)->name;

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:08:16

    The mysql_ extension has been abandoned since php5.5. It has been removed since php7 and can be replaced with MySQLi or PDO_MySQL extension.

    reply
    0
  • Cancelreply