MMO Starter Kit

For those who may be having problems getting to character list / be able to create a new character and have it go back to character list. Make sure MySQL stuff is correct (should say Logged In!) But if still not transitioning correctly please read below.

In current version there are couples problems that can be fixed one of two ways:

Easy way:
Change your PHP settings to turn off display errors
Reason: For some reason if php encounters an error, it will break, and not send any json data
http://php.net/manual/en/errorfunc.configuration.php

Fixing 3 small bugs

$chars = $conn->query($sql);


//if ($chars->num_rows == 0)  echo  json_encode(array('status'=>'NOCHARACTERS'));
//else {

//echo  json_encode(array('status'=>'HASCHARACTERS'));

while ($char = $chars->fetch_assoc()) 
{
	//add to array of characters:	
	$chararray] = array('id' => $char'id'], 'name'=>$char'name'], 'class'=>$char'class'], 'gender'=>$char'gender'], 'level'=>$char'level']);
}

echo json_encode(array('status'=>'OK', 'characters'=>$chararray));

TO

			$chars = $conn->query($sql);

			// If no rows then they have no Characters
			if ($chars->num_rows == 0)  echo json_encode(array('status'=>'OK', 'characters'=> null));/// No rows so no Characters
			// They have some amount of characters so lets return each of them
			else {
				while ($char = $chars->fetch_assoc()) 
				{
					//add to array of characters:	
					$chararray] = array('id' => $char'id'], 'name'=>$char'name'], 'class'=>$char'class'], 'gender'=>$char'gender'], 'level'=>$char'level']);
				}

				echo json_encode(array('status'=>'OK', 'characters'=>$chararray));
			}
  • In mmocreatecharacters.php
    Note: until gender is implemented in character creation we will hardcode it to 0
$gender = $mydata ->gender;

to

$gender = 0;

After that, hopefully it won’t depend on how your php is set up. :slight_smile: