0
Good, I have a problem that I have no idea what Ija. I have tried to do everything but nothing. Here’s the thing I’m doing a php chat but it’s giving Alert an error():
ERROR!
jQuery(function(){
jQuery('body').on('keyup', '.chat_msg', function(e){
if(e.which == 13){
var text = jQuery(this).val();
var idS = jQuery(this).attr('id');
jQuery.ajax({
type: 'MPOST',
url: 'sys/submsg.php',
data: {mensagem: text, de: idS},
success: function(retorno){
if (retorno == 'ok') {
jQuery('.chat_msg').val('');
}else{
alert('ERROR!');
}
}
});
}
});
});
The OTHER sys/submsg.php SCRIPT
<?php
if(isset($_MPOST["mensagem"])) {
@include_once('BD.class.php');
$mensagem = utf8_decode(strip_tags(trim(filter_input(INPUT_POST, 'mensagem', FILTER_SANITIZE_STRING))));
$de = (int)$_MPOST['de'];
$url = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".$steamauth['apikey']."&steamids=".$de);
$content = json_decode($url, true);
$name = htmlspecialchars($content['response']['players'][0]['personaname']);
$avatar = $content['response']['players'][0]['avatar'];
$urlName = $content['response']['players'][0]['profileurl'];
if($mensagem != ''){
$insert = BD::conn()->prepare("INSERT INTO `chat` (name,avatar,url,mensagem) VALUES (?,?,?,? ");
$arrayInsert = array($name,$avatar,$urlName,$mensagem);
if($insert->execute($arrayInsert)){
echo 'ok';
}else{
echo 'off';
}
}
}
?>
It’s like submite.php did not have to give pk the return is not receiving anything I thank whomever can help me :)
Missing one
)
here:VALUES (?,?,?,? "
...– Sergio