This topic is locked
[SOLVED]

 Before Display on edit popup page getting fatal error

5/11/2020 2:58:50 PM
PHPRunner General questions
L
lcslouis author

I am running a simple query. I have verified that the query works If I echo the result but using echo causes a sever error and the popup page doesn't open.
This is my Before Display code:



$rs = DB::Query("select IFNULL(CurrentQi,0) as CurrentQi from $CharacterProfile where ID=".$values['Profile']);

$values['CurrentQi'] = $rs->value("CurrentQi");


This is the error:



Fatal error: Uncaught Error: Call to a member function value() on boolean in E:\IIS\PHPRunnerProjects\ImmortalTaoist\include\viewbodyupgradecal_events.php:485 Stack trace: #0 E:\IIS\PHPRunnerProjects\ImmortalTaoist\classes\editpage.php(462): eventclass_viewbodyupgradecal->BeforeShowEdit(Object(XTempl), 'viewbodyupgrade...', Array, Object(EditPage)) #1 E:\IIS\PHPRunnerProjects\ImmortalTaoist\classes\editpage.php(345): EditPage->displayEditPage() #2 E:\IIS\PHPRunnerProjects\ImmortalTaoist\viewbodyupgradecal_edit.php(99): EditPage->process() #3 {main} thrown in E:\IIS\PHPRunnerProjects\ImmortalTaoist\include\viewbodyupgradecal_events.php on line 485


I am doing this according to the phprunner manual so I don't understand why this doesn't work and produces an error.

Sergey Kornilov admin 5/11/2020

A couple of issues here:

  1. The table name in your query doesn't seem to be right $CharacterProfile
  2. Do not use an alias in your SQL Query that is the same as the field name.

L
lcslouis author 5/11/2020

Found the error in SQL statement.

I still got the error after that When I moved the code to Process record values it now runs without any issue.