我想得到如下文本结果:
+----+-------+----------------------------------+----+
| id | login | pwd | su |
+----+-------+----------------------------------+----+
| 1 | root | c4ca4238a0b923820dcc509a6f75849b | 1 |
+----+-------+----------------------------------+----+
1 row in set (0.00 sec)
在 PHP(字符串)中。
php中的示例:
$query = mysql_query("SELECT * FROM users");
for (; $row = mysql_fetch_assoc($query); $data[] = $row);
我得到数组数组($data):
$data =
0 => (id=>1, login=>root..)
但我想把它作为字符串:
+----+-------+----------------------------------+----+
| id | login | pwd | su |
+----+-------+----------------------------------+----+
| 1 | root | c4ca4238a0b923820dcc509a6f75849b | 1 |
+----+-------+----------------------------------+----+
1 row in set (0.00 sec)
顺便说一句,查询“insert into users set login = 'sp', pwd = 1, su = 0”,这个字符串必须是“Query OK, 1 row affected, 2 warnings (0.18 sec)”。
像 sql 终端虽然 php!