AJAX chat script help?
-
So i am new to AJAX but pretty familar with php and javascript. I am trying to make a chat script but I am stuck on the find new chat partner part. The chat script will be one on one chat and when someone clicks "Find" I want it to search the database for other users that are looking for someone. So I thought I will make a column in the sql database that will be called "search".. yes if they are searching no if they arent. When they do find someone I thought i will have php make a new table for the chat messages to be held. The problem is I don't want duplicate tables made. How can I make it so that only 1 message table is made
-
Answer:
You should not be creating database tables on the fly during operation. Tables are something you create as part of your database design, and you create them once and leave them alone. Instead, have a table which stores all the chat messages, and have a column which associates the row with a particular user, etc.
Janice B at Yahoo! Answers Visit the source
Other answers
You don't want to create a temporary table...the resultset of your query IS a temporary table already and not one you'd want (or need) to retain indefinitely. All you want is something like SELECT userID FROM someTable WHERE searching = "yes" This would give you everyone currently searching at that moment. You could then use any number of methods to randomly pick one out of that set.
Just add "room" in your chat table! Have "common" for everyone. Allow people to create a room "name". Join me in my "room" and you just update the room from "common" to "myroom" !
Related Q & A:
- What is the simplest ajax upload plugin or script to be used with wordpress?Best solution by WordPress
- How to convert Oracle script to MySQL script?Best solution by Stack Overflow
- How to execute ajax script on Jquery mobile?Best solution by Stack Overflow
- I can't see what people are typing in the chat rooms ever since I was booted? Help.Best solution by answers.yahoo.com
- Mouseover script help?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.