", $text); //Get visit $ip = getUserIP(); $visit = ''; $q = mysqli_query($con, "SELECT id FROM stat_visit WHERE ip = '$ip';"); if (mysqli_num_rows($q) > 0){ $r = mysqli_fetch_array($q); $visit = $r["id"]; } //Insert row mysqli_query($con, "INSERT INTO post_comment (post, text, username, lang, visit) VALUES ($post, '$text', '$user', '$lang', '$visit');"); } elseif ($from == 'app'){ $code = mysqli_real_escape_string($con, $_POST["code"]); mysqli_query($con, "INSERT INTO post_comment (post, text, username, lang, app) VALUES ($post, '$text', '$user', '$lang', '$code');"); } //Prepare the page to update the comment section $q_comment = mysqli_query($con, "SELECT id, post, DATE_FORMAT(dtime, '%Y-%m-%dT%T') AS isodate, dtime, user, username, lang, text FROM post_comment WHERE post = $post AND approved = 1 ORDER BY dtime;"); while ($r_comment = mysqli_fetch_array($q_comment)){ ?>