doukang1962 2013-09-06 13:35
浏览 80
已采纳

从数据库获取所有数据并对客户端进行排序,这是最佳还是理想?

So I'm making a online chat program.

Technologies: -AJAX(methodology) -PHP -C# -ASP.net -JQuery -HTML5 -MYSQL -IIS

Issue (Long):

I've implemented group chat which works fine up to now. My issue is with multi-chat. Mind you I now realize i should have done the entire thing in PHP, but only knew ASP.net and C# when i started and will end up using PHP only, as a last resort. Anyway, when a multi-chat window is made, it injects the pre-made code via jquery into a div, stores it in sessionStorage for when the page refreshes, it loads the code from sessionstorage, and all ID's are incremented by one, for each user to have a max of 6 windows open at any given time. Now i'm trying to get specific query's for each specific users request like "SELECT * WHERE user1 privateChatID = '1' AND user2 privateChatID = '1'; (not the actual query, just pseudo code)", but since i'm using AJAX to get the query, I cant really manipulate the php file since it's loaded because the main file is a .aspx page. Now for group chat I'm using an update panel which works fine, but i can't dynamically make a draggable chat window, inside the update panel, because I'd have to use an ' runat="server" ' attribute, and if i run that in the pre-scripted jquery and wanted to increment the ID (like so: 'IDName "+ i +"'), visual studio/iis gives an error, hence the reason i'm trying to use Ajax. So all the problems I've worked out so far, once i get a working version I'll probably rethink the whole structure all together. My only issue now:

Issue (short): Would it be easier since i can't manupulate functions or variables in the php file, to just select everything from the DB ('message table') and sort everything client side? or would that not be optimal? OR is there a way to alter query's externally for a php file that is loaded by jquery?

  • 写回答

1条回答 默认 最新

  • dqc2017 2013-09-10 14:18
    关注

    So my solution was to create php files on the server that would have their own queries, and users would have their own directories on the server for those files and i guess any other files that might need to be added to them in the future if any. I'm taking a chance if the load of bandwidth is too much because a number of users will be creating files on the server, when a chat window is create, i don't even know how secure it'll be but it's working for the time being, i'll tweak security issues, after i can get everything working.

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

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?