我正在尝试远程连接到服务器的 MySQL 数据库并拉一行。但我有这个问题:
我能够提取一些特定的列数据,但不能提取整行。
例子 :
这有效:
-- Query 1
SELECT id, name, link, cat, image, title, features
FROM products
WHERE data_ready=1
ORDER BY id ASC
LIMIT 0,1
但这不起作用:
-- Query 2
SELECT *
FROM products
WHERE data_ready=1
ORDER BY id ASC
LIMIT 0,1
这也不
-- Query 3
SELECT id, name, link, cat, image, title, features, description
FROM products
WHERE data_ready=1
ORDER BY id ASC
LIMIT 0,1
请注意,在第三个查询中,我试图再提取一个description
不在查询 1 中的列。描述字段的长度是 1314。
有些东西限制了我可以获取的数据量,但我如何找到什么以及如何修复它?
顺便说一句, SELECT @@max_allowed_packet
产量为 1048576。
编辑
“不工作”意味着查询没有返回任何内容,但页面不断加载并最终超时。
是的,我已经直接在 Mysql 中测试了查询,它工作正常,
实际上,我有一个中央数据库服务器和许多客户端服务器,它们都从中央服务器获取数据。我能够将整个数据获取到所有客户端服务器,除了一个我面临这个问题的客户端服务器。所以我相信它与某种php.ini
设置有关。我比较了phpinfo()
所有服务器的设置,但无法找出可能导致此限制的原因。
显示表状态的结果,如“产品”;
Space usage
Data 438.8 MiB
Index 7.5 MiB
Total 446.3 MiB
Row Statistics
Format Compact
Collation latin1_swedish_ci
Next autoindex 2,015,640
Creation May 19, 2014 at 01:46 PM
--- 更多信息 --- 我的 PHP 代码很简单:
<?php
$conn=@mysql_pconnect("xx.xx.xx.xx","DBNAME","DBPASS")or die("ERROR CONNECTING TO MYSQL SERVER");
@mysql_select_db("DBUSERNAME",$conn)or die("ERROR CONNECTING TO DATABASE");
$sql="select id,pid,name,link,cat,image,title,features,price,description from products order by id asc limit 0,1";
$execute=mysql_query($sql,$conn);
$row=mysql_fetch_assoc($execute);
print_r($row);
?>
同样以下两个查询返回数据:
Query 4 - select id,pid,name,link,cat,image,title,features from products order by id asc limit 0,1
Query 5 - select id,pid,name,link,cat,image,title,description from products order by id asc limit 0,1
但是如果我尝试同时获取功能和描述,那么脚本永远不会完成并最终超时。IE
Query 6 - select id,pid,name,link,cat,image,title,features ,description from products order by id asc limit 0,1
相同的代码在我拥有的其他两台服务器上工作。但我无法弄清楚此服务器配置有什么问题:/