Problem with Ranks

Hi,

I’ve a problem with inserting of ranks.

If I open the “Pilot Ranks” site in the admin center, I get the following warning and the ranks are not displayed :

Invalid argument supplied for foreach() in …admin/templates/ranks_allranks.tpl on line 15

When I add a new rank, I get another warning:

Invalid argument supplied for foreach() in …core/common/RanksData.class.php on line 148

The “added” values are inserted in the sql-database. However, in the admin center, I cannot use the ranks.

What’s wrong?

Thanks for your assistance in this case.

Stephan

PS: Version 2.0.822

try to update to version 823

no problems on that version just tested it.

gr joeri

thanks, however the same failure appears. 

try to manual reupload the acourding templates

and try plz post the log and error logs.

gr joeri

I have uploaded the "ranks_allranks.tpl " (version 823) manually.

The log.txt and error.txt are empty.

Nothing has changed.

in your local config did you set debug to true?

and don’t forget set writing permissions

debug is now true. i’ve a log-file.

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261324477))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261324477))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261410877))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261410877))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261497277))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261497277))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261583677))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261583677))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261670077))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261670077))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261756477))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261756477))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261842877))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261842877))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261929277))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261929277))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261324490))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261324490))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261410890))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261410890))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261497290))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261497290))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261583690))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261583690))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261670090))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261670090))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261756490))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261756490))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261842890))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261842890))’ at line 2

Caller: DB::write_debug->DB::get_row->PIREPData::getReportCount->PIREPData::ShowReportCounts->Dashboard->pirepcounts->call_user_func_array->MainController::RunAllActions

SELECT COUNT(*) AS count FROM vms_pireps

WHERE DATE(submitdate)=DATE(FROM_UNIXTIME(1261929290))

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(submitdate)=DATE(FROM_UNIXTIME(1261929290))’ at line 2

Caller: DB::write_debug->DB::get_results->RanksData::GetAllRanks->PilotRanking->pilotranks->call_user_func_array->MainController::RunAllActions

SELECT r.*, (SELECT COUNT(*) FROM vms_pilots WHERE rank=r.rank) as totalpilots

FROM vms_ranks r

ORDER BY r.minhours ASC

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(*) FROM vms_pilots WHERE rank=r.rank) as totalpilo

Caller: DB::write_debug->DB::get_results->RanksData::GetAllRanks->RanksData::CalculatePilotRanks->RanksData::AddRank->PilotRanking->add_rank_post->PilotRanking->pilotranks->call_user_func_array->MainController::RunAllActions

SELECT r.*, (SELECT COUNT(*) FROM vms_pilots WHERE rank=r.rank) as totalpilots

FROM vms_ranks r

ORDER BY r.minhours ASC

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(*) FROM vms_pilots WHERE rank=r.rank) as totalpilo

Caller: DB::write_debug->DB::query->LogData::addLog->PilotRanking->add_rank_post->PilotRanking->pilotranks->call_user_func_array->MainController::RunAllActions

INSERT INTO vms_adminlog (pilotid, datestamp, message)

VALUES (‘1’, NOW(), ‘Added the rank “test3”’)

Table ‘db279538883.vms_adminlog’ doesn’t exist

Caller: DB::write_debug->DB::get_results->RanksData::GetAllRanks->PilotRanking->pilotranks->call_user_func_array->MainController::RunAllActions

SELECT r.*, (SELECT COUNT(*) FROM vms_pilots WHERE rank=r.rank) as totalpilots

FROM vms_ranks r

ORDER BY r.minhours ASC

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT COUNT(*) FROM vms_pilots WHERE rank=r.rank) as totalpilo

writing permissions for which ordner?

Do you have ranks entered?

Also, looks like you didn’t run the /install/update.php file on updating to 823.

Yes, ranks are stored in the database table.

Yes, I run /install/update.php.

Ok I will take a look.

When you edit a pilot’s profile, can you manually assign a rank to them?

Try filling a PIREP as well

Also, I think something is screwed up with your database, those are some weird errors

ok, thanks.

I can’t edit the “Current Rank” of a pilot in his profile.

Pirep filling is ok.

Also, I think something is screwed up with your database, those are some weird errors

I’ve installed the version (1.2.700) and updated to 822 and 823 with the update.php.

Another info, maybe it helps:

The warning/failure was already there after the normal installation of the 1.2.700 version.

Another info, maybe it helps:

The warning/failure was already there after the normal installation of the 1.2.700 version.

Something didn’t setup properly with the database then. Can you do a fresh install with a new database? Export your schedules/pireps

Hi,

I’ve done a new installation based on the latest beta from http://www.phpvms.net/downloads “Download the latest beta (full install)”.

During the install process, some sql errors appear.

Writing “phpvms_test.phpvms_adminlog” table… failed - manually run this query:

“CREATE TABLE phpvms_test.phpvms_adminlog ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , pilotid INT NOT NULL , datestamp DATETIME NOT NULL , message VARCHAR( 255 ) NOT NULL ) ENGINE = MYISAM ;”

Writing “phpvms_downloads” table… failed - manually run this query:

“CREATE TABLE phpvms_downloads ( id INT NOT NULL AUTO_INCREMENT, pid INT, name VARCHAR(50), description TEXT ASCII, link TEXT ASCII, image TEXT ASCII, hits INT, PRIMARY KEY (id) ) ENGINE = MyISAM;”

Writing “phpvms_fieldvalues_ibfk_1 FOREIGN KEY (fieldid) REFERENCES phpvms_customfields” table… failed - manually run this query:

“ALTER TABLE phpvms_fieldvalues ADD CONSTRAINT phpvms_fieldvalues_ibfk_1 FOREIGN KEY (fieldid) REFERENCES phpvms_customfields (fieldid) ON DELETE CASCADE, ADD CONSTRAINT phpvms_fieldvalues_ibfk_2 FOREIGN KEY (pilotid) REFERENCES phpvms_pilots (pilotid) ON DELETE CASCADE;”

Writing “phpvms_groupmembers_ibfk_1 FOREIGN KEY (groupid) REFERENCES phpvms_groups” table… failed - manually run this query:

“ALTER TABLE phpvms_groupmembers ADD CONSTRAINT phpvms_groupmembers_ibfk_1 FOREIGN KEY (groupid) REFERENCES phpvms_groups (groupid) ON DELETE CASCADE, ADD CONSTRAINT phpvms_groupmembers_ibfk_2 FOREIGN KEY (pilotid) REFERENCES phpvms_pilots (pilotid) ON DELETE CASCADE;”

Writing “phpvms_pirepcomments_ibfk_1 FOREIGN KEY (pirepid) REFERENCES phpvms_pireps” table… failed - manually run this query:

“ALTER TABLE phpvms_pirepcomments ADD CONSTRAINT phpvms_pirepcomments_ibfk_1 FOREIGN KEY (pirepid) REFERENCES phpvms_pireps (pirepid) ON DELETE CASCADE ON UPDATE CASCADE;”

I have executed all sql-statements manually. However, according to my opinion, there are some statements in the install.sql file which seem to be wrong.

First warning:

why CREATE TABLE phpvms\_test.phpvms\_adminlog ?

Isn’t it only CREATE TABLE phpvms_adminlog.

Second warning:

I’ve inserted the table manually. But I don’t know why the sql-code does not work automatically.

Third warning:

Sql-Code is ok. However, the key index  for ‘fieldid’ and ‘pilotid’ was not defined during creating the table phpvms_fieldvalues. See line 302 in the install.sql-file. I think, there should be the follwing statement:

KEY ‘fieldid’ (‘fieldid’),

KEY ‘pilotid’ (‘pilotid’)

Fourth warning:

Analogously to third warning. Index of ‘groupid’ and ‘pilotid’ is missing in the table phpvms_pirepcomments .

Missing lines at line 320 of the install.sql:

KEY ‘groupid’ (‘groupid’),

KEY ‘pilotid’ (‘pilotid’)

Sixth warning:

Analogously as above. Index of ‘pirepid’ is missing in the table phpvms_groupmembers.

Missing lines at line 320 of the install.sql:

KEY ‘pirepid’ (‘pirepid’)

After the manually amendment of the sql-tables, I have continued the installation process.

Then, on the last page after a click on the button “finish”, the following message appears:

Warning: Invalid argument supplied for foreach() in …core/common/RanksData.class.php on line 144

Warning: Invalid argument supplied for foreach() in …core/common/RanksData.class.php on line 183

Your site is all setup! You can login to the admin panel here

Also, don’t forget to register at vaCentral, the best place for VA ranks and news. Join the virtual airline world, and pit your virtual airline against the many others.

The RanksData.class shows at these lines:

Line 114:

$pilots = PilotData::GetAllPilots();

$allranks = self::GetAllRanks();

foreach($pilots as $pilot)

{

Line 183:

$pilotid = intval($pilotid);

$allranks = self::GetAllRanks();

$pilot = PilotData::GetPilotData($pilotid);

foreach($allranks as $rank)

{

After a login in the admin center, the same failure, as mentioned above in this thread, appears at “ Pilot Ranks” and no ranks are shown:

Warning: Invalid argument supplied for foreach() in …admin/templates/ranks_allranks.tpl on line 15

Has someone an idea?

Thanks, Stephan

I fixed the adminlog one in the latest beta (836, I hate how the build log is so slow)

The key errors are ok, that’s the format phpmyadmin had dumped them out so I’m assuming they’re ok.

What MySQL version are you running? And is innodb enabled? Can you do a dump of structure from phpmyadmin and attach it to your post?

EDit: I just checked, the install.sql didn’t update. grr. But the other errors you’re getting are strange.

EDit: I just checked, the install.sql didn’t update. grr.

No problem 

Now I’ve done a new install of the 700, then an update to 828. The MySQL database has the version 5.0.

The installation was without errors and it works all right now. But I don’t know why. The first installation was equal to the last one. I monitor the further proceeding.

Thanks all for their time and help!

Regards, Stephan

No problem. 838 is up right now, though build log is behind. You can try that for a fresh install.