Vyskúšal som cez WHERE, a stále nič.
<?php
session_start();
$session_username = $_SESSION['user'];
if ($session_username == "") {
header("refresh=0; url=login.php");
}
function zisti_id() {
$mysql_server = "localhost";
$mysql_user = "root";
$mysql_password = "None";
$mysql_db = "gasdbgahs";
$sqli = new mysqli($mysql_server, $mysql_user, $mysql_password, $mysql_db);
if ($sqli->connect_errno) {
printf("Connection failed: %s \n", $sqli->connect_error);
exit();
}
$sqli->set_charset("utf8");
$session_username = $_SESSION['user'];
$sql = mysqli_query($sqli, "SELECT * FROM users WHERE id='$session_username' LIMIT 1");
$zisti = mysqli_fetch_array($sql, MYSQLI_BOTH);
echo $zisti["id"];
}
?>