This topic is locked

Register page with lookup giving syntax error?????

1/11/2009 4:58:07 PM
PHPRunner General questions
W
wildwally author

I've added the register feature and modified it to include more fields. The last 5 fields are looking into the USERS table to provide a list. I'm trying to narrow the list being displayed with the WHERE feature, and inputed this:
"JOBCLASS=("Application Engineer")"
Using the test it button, it works fine. But when I upload and test it out I get a Syntax error:
Parse error: syntax error, unexpected T_STRING in mylocation\output\oldinclude\commonfunctions.php on line 120



When I reset the WHERE box and upload and test, the Parse error is gone so I know it has to do with the WHERE feature. Whats confusing is it works using the test it feature.

C
chaintm 1/11/2009

sounds like a version conflict to me, I would check the version of your apache or sql all depending on your server and the one on the live server. I have a feeling one is outdated.
also i posted a good syntex checker here...
http://www.asprunner.com/forums/index.php?showtopic=10387
this will help clear up if it is actually php or what. I still beleive it is your versions.

W
wildwally author 1/11/2009

Thanks for your help, but it still says the same thing.
here is a section from the checker, the red arrow shows where the error is but the site also states that it could be the line prior:
115: {


116: global $strTableName;


117: if(!$table)


118: $table = $strTableName;


119: if($table=="users" && $field=="MyAE")


120: return "JOBCLASS=("Application Engineer")";


121: if($table=="users" && $field=="MyQP")


122: return "JOBCLASS=("QuickPen Operator")";

C
chaintm 1/11/2009

well your only allowed one return statement in a table function statment routine body. That is part of your problem, you might want to attempt re-organizing the way you use your statements or sepeate them if possible. I don't know the whole essences of your code, but thats a good place to start <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36704&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> seperating your if statements would do that. Your call thou.
115: {

116: global $strTableName;

117: if(!$table)

118: $table = $strTableName;

}

119: if($table=="users" && $field=="MyAE")

120: return "JOBCLASS=("Application Engineer")";

{

121: if($table=="users" && $field=="MyQP")

122: return "JOBCLASS=("QuickPen Operator")";
etc etc
ps. dont feel bad we all forget/make mistakes, heck I have a post about continuing to carry on an array , I am just drawing a blank., it happens to us all <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36704&image=2&table=forumreplies' class='bbc_emoticon' alt=';)' />

W
wildwally author 1/11/2009

Bad thing about it; I didn't write any of it. This is the output generated from within PHPRUNNER, I tried to include the whole snippet from the syntax error checker but it would due to too many images. so here is the text version of the code showing a little more.
// return Lookup Wizard Where expression

function GetLWWhere($field,$table="")

{

global $strTableName;

if(!$table)

$table = $strTableName;

if($table=="users" && $field=="MyAE")

return "JOBCLASS=("Application Engineer")";

if($table=="users" && $field=="MyQP")

return "JOBCLASS=("QuickPen Operator")";

if($table=="users" && $field=="MyInstallmgr")

return "JOBCLASS=("Manager (Operations)")";

if($table=="users" && $field=="MyFoodservice")

return "JOBCLASS=("Food Service")";

if($table=="users" && $field=="MyHVAC")

return "JOBCLASS=("HVAC")";

return "";

}

C
chaintm 1/11/2009

ahh ok so this is tied into the other script pages.. eek! yea this is a job for the developers, aka admins... only thing I would do at this point is attempt to change the naming. but other then that , because the way the code is tied in from page to page, trying to trace this would be a big job, sadly not enough time for me to look at it for you. Sorry I couldn't help, but I am sure monday you will have a reply when Jane gets back.

W
wildwally author 1/12/2009

if anyone can help, she can.

J
Jane 1/13/2009

Hi,
here is the correct WHERE clause:

"JOBCLASS='Application Engineer'"

W
wildwally author 1/14/2009