function send()
{
var mess=$("#mess_to_send").val(); => var num = $("#id_to").val();
data:"mess="+mess, => data:"mess="+mess+"&num=" + num;
$.ajax({
type: "POST",
url: "add_mess.php",
data:"mess="+mess+"&num=" + num;
success: function(html)
{
load_messes();
$("#mess_to_send").val('');
$("#id_to").val('');
}
});
}
session_start();
setcookie('username', $row['username'], time() + (60*60*24*30));
setcookie('user_id', $row['user_id'], time() + (60*60*24*30));
print_r($_COOKIE);
if(isset($_POST['mess']) && $_POST['mess']!="" && $_POST['mess']!=" ")
{
$mess=$_POST['mess'];
$username=$_COOKIE['username'];
$num=$_POST['num'];
include("bd.php");
$res=mysql_query("INSERT INTO `messages` (`login`,`message`,`id_add`,`id_to`) VALUES ('". $_COOKIE['username'] . "','$mess','". $_COOKIE['user_id'] ."','$num' ) ");
// $res=mysql_query("INSERT INTO `messages` (`login`,`message`,`id_add`,`id_to`) VALUES ('". $_COOKIE['username'] . "','$mess','". $_COOKIE['user_id'] . "','$num') ");
}
?>
<?php
$mysql_select = "SELECT * FROM `files` WHERE `pac_id` = '" . $_COOKIE['user_id'] . "'";
$result = mysql_query($mysql_select);
$row = mysql_fetch_array($result);
$n=mysql_num_rows($result);
$fileName = mysql_result($result, $i, file_name);
$encodedFileName = htmlentities(urlencode($fileName));
$uploadedOn = mysql_result($result, $i, uploaded_on);
$usernameAdd = mysql_result($result, $i, username_add);
$html = <<<HTML
<table border=1>
<th>Nr</th>
<th>Nazwa pliku:</th>
<th>Data dodania:</th>
<th>Przesłany przez:</th>
<th>QR-kod:</th>
{ for($i=0;$i<$n;$i++) }
<tr>
<td><p3></p3></td>
<td><a href='../doctor/Pliki/{$fileName}'>{$fileName}</a></td>
<td>{$uploadedOn}</td>
<td>{$usernameAdd}</td>
<td><img src='http://chart.apis.google.com/chart?cht=qr&chs=150x150&chl=http://bazadannych.cba.pl/menu/doctor/Pliki/{$encodedFileName}'></td>
</tr>
</table>
HTML;
echo $html;
while($row = mysql_fetch_array($result));
?>