hello,
can any1 me help with live chat module in php for e-commerce site???how to keep the track of visitor's queries and replies in DATABASE?
Plz help
What eCommerce package and what live chat module are you using?
phpHelp you have a lot of work reading and understanding upon you if you are a programmer . If you are just a client than just Google it …. If you are a programmer I have made such projects and I would be happy to share with you any knowledge through a common ground …
how can add live chat in wordpress
my site is <URL SNIPPED>
@jkon...i am a programmer....i want to build a chat module in php...how to proceed???
thanks..:)
You'll prob. want Ajax or Comet.
I am sorry for not responding sooner, and that in the second phrase of my first answer I didn’t clarify that because of the nature of PHP , programming a chat app from the scratch requires significant amount of effort in modeling and programming.
As diafol suggested you can use Ajax , or Comet (I haven’t any experience with the last technique so I can’t say anything more). I believe that now is the time for a web programmer to start working with Web Sockets in such projects. Of course because some users may still have browsers that don’t support Web Sockets the web app should be in both environments (WS and Ajax).
First of all I would advise if your server allow the use of Web Sockets. Than understand a bit how this work, and after that make a simple respond message web app (a Hello Who) using Web Sockets and when they aren’t supported in client side using AJAX with the same business logic.
After that you have the step to model your chat web application. If you have any specific question designing the model of course we are here to help.
I understand that all of these have no meaning to somebody that has no clue about programming with AJAX and Web Sockets. So the first step for such a programmer is to get acquaintance with those technologies (to be sincere AJAX and Web Sockets are knowledge that a web programmer will find lot times in the work, so nothing will be wasted)
I hope I helped a little; it isn’t a question that I can answer with few lines of code. If there is a specific code that troubles you please share it , and I will do my best.
Use AJAX and jQuery and PHP. That is how I made my site's chat. And store the user's names and which other data and store each individual message in the database. Here is a example:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
// This is to load the chats
$(document).ready(function(){
$('#messages').load('feed.php');
});
function update(){
$('#div').load('feed.php');
}
setInterval(update(), 2);
</script>
And the PHP code:
post_message.php:
<?php
session_start();
// Example: Store the messages and stuff in the db
mysql_connect('localhost', 'root', '');
mysql_select_db('db');
// Values
// Make the input safe.
$name = mysql_real_escape_string(htmlentities($_POST['name']));
$email = mysql_real_escape_string(htmlentities($_POST['email']));
$message = mysql_real_escape_string(htmlentities($_POST['message']));
// Insert into the database
mysql_query("INSERT INTO table_name ('client_name', 'client_email', 'message') VALUES('{$name}','{$email}','{$message}')");
?>
And the form code:
<form action="post_message.php" method="POST">
<label for="name">Your name:</label><input type="text" name="name" size="25" /><br />
<label for="email">Your email</label><input type="text" name="email" size="25" /><br />
<label for="message">Enter your message:</label><br />
<input type="text" name="message" size="25" /><br />
<input type="submit" value="Send" />
</form>
And, finally, to display the message(s):
<b>Messages:</b>
<div id="messages"></div>
To display the feed:
feed.php:
<?php
session_start();
// Get the messages from the DB
mysql_connect('localhost', 'root', '') or die(mysql_error());
mysql_select_db('DB') or die(mysql_error());
$messages = mysql_query("SELECT * FROM table_name");
while($row = mysql_fetch_array($messages)){
$name = $row['name']; // Client's name
$message = $row['message']; // Message
$id = $row['id']; // Message ID
echo "<div id='message_$id'>" . "<b style='color:red;'>" . $name . "</b>" . " " . "<b>" . $message . "</b>" . "</div>";
}
?>
This is just a starter template. You can modify it to however your needs are.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.