将mysqli连接对象转换为连接字符串

时间:2013-11-03 05:28:50

标签: php mysql mysqli

我们可以将mysqli连接对象转换为字符串连接。

$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

我们可以将$ mysqli转换为程序性查询吗?或者它是不可能的。

$query = "SELECT * FROM City ORDER by ID DESC ";

if ($result = mysqli_query($mysqli, $query)) {

    /* fetch associative array */
    while ($obj = mysqli_fetch_object($result)) {
        printf ("%s (%s)\n", $obj->Name;
    }

1 个答案:

答案 0 :(得分:0)

您可以将mysqli与过程样式一起使用,因为它支持面向对象的扩展接口和过程接口。

see this