Closed soodarvind closed 11 years ago
<?php require_once 'lou.class.php'; require_once './vendor/j4mie/idiorm/idiorm.php'; require_once './vendor/j4mie/paris.paris.php'; ORM::configure('mysql:host=localhost;dbname=lou'); ORM::configure('username', 'admin'); ORM::configure('password', 'password'); .... then db functions
?>
When I run my php, it also responds with a HTTP 200 message, but no data populates.
When i try to run idiorm.php direct, it responds ok HTTP 200.
When I try to run paris.php direct, it gives me a HTTP 500 error.
I am trying to run the demo php's provided, but again, after configuring the ORM as per instructions there, I get http 200 errors.
What am I doing wrong?
Here's all my source, masking my authentication data.
My relative path actually requires the dot/period. Running in xdebug without, it fails to find the file(s) paris.php or idiorm.php - which have been installed into the relative subdirectories.
am trying to use xdebug but it isn't showing me any errors.
<!DOCTYPE html> <?php
require_once 'lou.class.php';
require_once './vendor/j4mie/idiorm/idiorm.php';
require_once './vendor/j4mie/paris/paris.php';
ORM::configure('mysql:host=localhost;dbname=lou');
ORM::configure('username', 'admin');
ORM::configure('password', 'password');
Class Player extends Model{}
Class PlayerScore extends Model{}
$lou = LoU::createClient( './cookies/' );
$lou->login( 'xyz@xyz.com', 'abcd' )->selectWorld( 232 );
function getRankList( $type )
{
global $lou;
$type = ucfirst( strtolower( $type ) );
$count = $lou->get( $type . 'GetCount', array( "continent" => -1,"sort" => 0,"ascending" => true,"type" => 0 ) );
$iter = intval( $count / 400 );
$left = intval( $count % 400 );
$start = 0;
$end = 399;
$send = array();
for ($x = 0; $x < $iter; $x++)
{
$send[] = array( 'start' => $start, 'end' => $end );
$start += 400;
$end += 400;
}
if( $left > 0 )
{
$send[] = array( 'start' => ( $count - $left ), 'end' => ( $count - 1 ) );
}
$data = array();
foreach( $send as $s )
{
$s = array_merge( $s, array( "continent" => -1,"sort" => 0,"ascending" => true,"type" => 0 ) );
$res = $lou->get( $type . 'GetRange', $s );
$data = array_merge( $data, $res );
}
return $data;
}
$alliance_name = 'Scrubber Duckies';
$alliance_id = 0;
// Our function at work!
$alliance_list = getRankList( 'alliance' );
foreach( $alliance_list as $alliance )
{
if( strtolower( $alliance_name ) == strtolower( $alliance->n ) )
{
$alliance_id = $alliance->i;
}
}
$members = $lou->get( 'GetPublicAllianceMemberList', array( 'id' => $alliance_id ) );
foreach( $members as $member )
{
// Store player info
$player_db = Model::factory( 'Player' )->find_one( $member->i );
// Record not found, create it
if( !$player_db instanceof Player )
{
$player_db = Model::factory( 'Player' )->create();
$player_db->id = $member->i;
$player_db->alliance_id = $alliance_id;
$player_db->name = $member->n;
}
$player_db->updatedAt = date( 'Y-m-d H:i:s' );
$player_db->save();
// Store player score
$player_score_db = Model::factory( 'PlayerScore' )->where( 'player_id', $member->i )->where( 'day', date( 'Y-m-d' ) )->find_one();
// Record not found create a new entry
if( !$player_score_db instanceof PlayerScore )
{
$player_score_db = Model::factory( 'PlayerScore' )->create();
$player_score_db->player_id = $member->i;
$player_score_db->day = date( 'Y-m-d' );
}
$player_score_db->alliance_id = $alliance_id;
$player_score_db->score = $member->p;
$player_score_db->rank = $member->r;
$player_score_db->city_count = $member->c;
$player_score_db->updatedAt = date( 'Y-m-d H:i:s' );
$player_score_db->save();}
?>
What are your table names in the database?
player and player_score.
i am going to go back and exclude all other codes and make sure the basic paris and idiorm modules work on my environment, then go from there.
I have not had a chance to read your code. I am not sure why your installation is not throwing any errors. Is it writing to an error log rather than displaying errors?
Have you made any progress on this issue? Anything further I can do to help?
I installed as per your instructions, and while idiorm.php returns HTTP 200 OK, Paris.php bungs an error every time I try to test with it.