Php PDO fetchAll结果只返回一个记录问题

Php PDO fetchAll结果只返回一个记录问题,php,mysql,pdo,inner-join,fetchall,Php,Mysql,Pdo,Inner Join,Fetchall,我在本地主机中开发了以下脚本(使用wamp 2.2、apache 2.2.1 windows、PHP5.3.9、mysql 5.5.20)。当我将脚本上传到生产服务器时(apache 2.2.29 unix、php 5.3.29、mysql 5.5.42) 我注意到php+pdo脚本并没有以与本地服务器中相同的方式返回所有获取的行 如果我尝试添加一个“order by”sql实例,它在本地运行得很好,但在生产服务器中,结果获取的行总是相同的 还尝试更改我的内部联接表顺序,结果相同。 有什么线索吗

我在本地主机中开发了以下脚本(使用wamp 2.2、apache 2.2.1 windows、PHP5.3.9、mysql 5.5.20)。当我将脚本上传到生产服务器时(apache 2.2.29 unix、php 5.3.29、mysql 5.5.42)

我注意到php+pdo脚本并没有以与本地服务器中相同的方式返回所有获取的行

如果我尝试添加一个“order by”sql实例,它在本地运行得很好,但在生产服务器中,结果获取的行总是相同的

还尝试更改我的内部联接表顺序,结果相同。 有什么线索吗?也许是一个错误的内部连接

php+pdo:
表结构:

Table structure for historia: id(text, primary key)
Table structure for pub_us: id(int,auto increment, primary key), comic(text), historia(text, related to table historia.id)

检索到的数据:

Results in local wamp:
|| idhistoria      || comic               || id    ||
|| fantfour-1-001b || fantasticfour/1/001 || 25356 ||
|| fantfour-1-001  || fantasticfour/1/001 || 16449 ||
|| fantfour-1-001a || fantasticfour/1/001 || 3772  ||

Results in server :
|| idhistoria      || comic               || id   ||
|| fantfour-1-001a || fantasticfour/1/001 || 3772 ||

多亏了@rmertins的线索,我解决了这个问题

表“historia”与INNODB引擎一起使用,表“pub_us”与MyISAM一起使用,所以引擎之间的差异只导致一行

解决了将引擎更改为相同的问题(本例中为INNODB)


谢谢你的评论和线索,我希望这能帮助别人

我觉得没问题。你确定你的数据库是同步的吗?可能是var_dump$data来检查查询是否正确执行,数据库是否同步。我使用服务器的phpmyadmin通过一个简单的“select*from pub_es where pub_us.comic=“fantasticfour/1/001”检查结果“我看到三个结果是一致的。接下来,我在同一phpmyadmin中尝试上面的sql查询,它只给出一个结果。顺便说一句:这不是愚人节:/Check数据库排序规则,characterset,同样适用于您的表和字符集的连接。所有这些都会影响数据库的排序方式。
Results in local wamp:
|| idhistoria      || comic               || id    ||
|| fantfour-1-001b || fantasticfour/1/001 || 25356 ||
|| fantfour-1-001  || fantasticfour/1/001 || 16449 ||
|| fantfour-1-001a || fantasticfour/1/001 || 3772  ||

Results in server :
|| idhistoria      || comic               || id   ||
|| fantfour-1-001a || fantasticfour/1/001 || 3772 ||