Reply to thread

That can only happen if the code is not correct:


[CODE]<?php

// Starter

$getStats = mysql_query("SELECT null FROM `user_stats` WHERE id = '".$_SESSION['user']['id']."'");

if(mysql_num_rows($getStats) != 1){

  $getRoomKit = mysql_fetch_assoc(mysql_query("SELECT * FROM room_starterkit ORDER BY RAND() LIMIT 1"));

  $welcomeMessage = "Welcome " . $_SESSION['user']['username'];

  mysql_query("INSERT INTO `rooms` (caption,owner,description,model_name,wallpaper,floor) VALUES ('".$welcomeMessage."', '".$_SESSION['user']['id']."', 'Welcome to Hablore', '".$getRoomKit['room_Model']."', '".$getRoomKit['room_Wallpaper']."', '".$getRoomKit['room_Floor']."') ");

  $theRoomID = mysql_fetch_assoc(mysql_query("SELECT id FROM `rooms` ORDER BY `id` DESC LIMIT 1"));

  mysql_query("UPDATE `users` SET `home_room` = '".$theRoomID['id']."' WHERE `id` = '".$_SESSION['user']['id']."'");

  $getRoomItems = mysql_query("SELECT * FROM room_itemkits WHERE roomKit = '".$getRoomKit['id']."'");


  while($currItem = mysql_fetch_assoc($getRoomItems)){

    mysql_query("INSERT INTO `items`(user_id,room_id,base_item,extra_data,x,y,z,rot,wall_pos) VALUES ('".$_SESSION['user']['id']."','".$theRoomID['id']."','".$currItem['item_BaseID']."', '".$currItem['extra_data']."', '".$currItem['x']."', '".$currItem['y']."', '".$currItem['z']."','".$currItem['rot']."', '".$currItem['wall_pos']."')");

  }


}

?>[/CODE]



$getStats = mysql_query("SELECT null FROM `user_stats` WHERE id = '".$_SESSION['user']['id']."'");

if(mysql_num_rows($getStats) != 1){


This will test if they have ever entered the client before, because on first login you get a row created for your user stats


Top