I have developed a live help program using ajax with php.
i have got it working as i want except i’ve noticed something strange.
i can chat the the operator fine but i can’t say the same thing twice.
this is how i send the message:
[code]
function sendAdmin(idx)
{
var url = “sendAdmin.php?id=”;
var desc = document.getElementById(idx).value;
http.open(“GET”, url + idx + “&desc=” + desc, true);
http.send(null);
document.getElementById(idx).value = “”;
}
so that is sending the id of the chat textbox and whatever it contained to sendAdmin.php
in sendAdmin i simply write the info to the db:
[code]
<?php
include(“dbinfo.inc.php”) ;
$idFull = $_GET[‘id’] ;
$desc = $_GET[‘desc’] ;
list($msg, $id, $parent) = split(‘-‘, $idFull) ;
$sql = “INSERT INTO log (LogID, ClientID, `Message`, `TimeStamp`, `Parent`) VALUES (NULL, $id, ‘$desc’, CURRENT_TIMESTAMP, ‘$parent’)”;
mysql_query($sql) ;
?>
its pretty basic, but if i enter “hello” twice it won’t show the second time, it definately not a db problem because i changed what it is writing to the db and it can add the message no problem.
also if i write “hello” then something else and try “hello” again it still doesn’t write.
i’m pretty sure the sendAdmin function in my js file is ignoring it if it has the same desc.
can anyone shed any light?
Cheers guys