How to Mix MySQL APIs in PHP

Can I mix MySQL APIs in PHP?

No, you can't use mysql and mysqli together. They are separate APIs and the resources they create are incompatible with one another.

There is a mysqli_close, though.

I have problem with php code connecting to MySQL

You can not mix mysql_* and mysqli_* functions, they are two different APIs. The mysql_* functions have been deprecated and should no longer be used. mysqli_* doesn't have an equivalent function, but you can do mysqli_query($link_id, 'SHOW DATABASES') and then iterate over the results. See mysqli_query() for examples.



Related Topics



Leave a reply



Submit