duanchen7036 2016-08-03 22:40
浏览 71
已采纳

在本地计算机上工作的多个MySQL查询但不是远程计算机

I have a dev Windows VM that serves an angularJS app via WAMP. I have been working on the app locally on an iMac that uses MAMP Pro, getting data from the database I've set up on the VM. Unfortunately, when I uploaded everything to the VM for remote testing, the queries start returning empty data and then quit altogether.

In the app is a PHP script that connects to the database using an object supplied via angular's $http method, assembled using a service to provide the query and success/failure functionality. The PHP script then returns a JSON object constructed from the result of the query. This script is used multiple times to get the data for the app. The login scenario is a good example:

In verifyUser = function(username){}, the db is queried for a user, base on a text field entry:

query:"SELECT * FROM xmx_users WHERE user='" + username + "'"

If no user exists with username, addUser = function(username){} is called to add them the db:

query:"INSERT INTO xmx_users (`user`) VALUES ('" + username + "')"

Otherwise the user's content provider list is requested via getUserProviders = function(username){}:

query:"SELECT * FROM xmx_users_providers WHERE user='" + username + "'"

If no provider list exists for the user, get a default list of all providers via getDefaultProviders = function(){}:

query:"SELECT * FROM xmx_providers WHERE active=true;

As stated above, this chain of queries works perfectly on my local machine.

When running on the VM, the first query runs as it does locally up until getDefaultProviders = function(){}, which returns an empty result, and the app just sits there.

What confuses me is how it works for the first three functions but quits the fourth, and that it's only happening on the VM.

Any ideas on what may be causing this? I can post code as necessary, just figured maybe there might be some non-code things to look at first?

  • 写回答

1条回答 默认 最新

  • dsepcxw181184853 2016-08-03 23:39
    关注

    After continued digging I found the problem... I was copying some of the data from an Excel spreadsheet and Wamp evidently didn't like some of M$'s hidden formatting. :O

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换