I have a xampp website with a little game in it, after reinstalling my pc the game wont work after login.
Basicly the login works perfeclty but at this parts its failing:
if($datauser[0]['factionid'] == 0)
{
header('Location: company.php');
exit();
}
At this point its redirecing me to the company.php but my factionid = 1 and when i remove it, it shows me that the Offset 0 is undefined. Basicly it cannot load my user information.
This is the $datauser information request.
include 'libs/database.php';
include 'config/database.php';
$db = new Database(DB_TYPE, DB_HOST, DB_NAME, DB_USER, DB_PASS);
$sth = $conn->prepare("SELECT username, is_admin , grade, factionid, clanid, credits, uridium, unobtanium, premium_time, vip_time, rankpoints, user_kill, npc_kill, max_hp, speed, damages,
max_shield, drones, apis_built, zeus_built, laser_count, shield_count, speed_count, logfiles, booty_keys, drone_parts, skilltree, booster_dmg_time,
booster_shd_time, booster_spd_time, booster_npc_time, shipId, undermaintenance
FROM users WHERE id = :id LIMIT 1");
$sth->execute(array(
':id' => $_SESSION['player_id']
));
$datauser = $sth->fetchAll();
now i hope i explained enought and someone can help me. Ill be there for any questions or more code to awnser.
EDIT#1: its working perfectly on my remote server with IIS, but not on my XAMPP local server.
EDIT#2: its working if ill change prepare statement to:
$sth = $db->prepare("SELECT * FROM users WHERE id = :id LIMIT 1");
so why is it working with the * but not with all my values?
EDIT#3: FOUND THE SOLUTION, i searched for the value of "undermaintenance" but it was missing in my local database. Thanks everyone who helped me.
Greetings, Kevin