mysql to mysqli conversion

If you used an older version of PHP and switched to PHP7, and now all your msyql  commands are failing, you should be able to use the following to fix it. You’ll have to run it in every directory where you have php files, of course.

sed -i 's/mysql_query(\([^,()]*\),\([^,()]*\))/mysqli_query(\2,\1)/g;'\
's/mysql_n/mysqli_n/g' *.php


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.