This topic is locked
[SOLVED]

 global $conn in onload event

9/6/2011 10:35:18 AM
PHPRunner General questions
O
orodriguez author

Hello,
From this topic Run sql Statement via button? i'm trying to add the code in the Javascript on load event



global $conn;

if(@$_POST["sql"]=="1")

{

db_exec("update ... set...",$conn);

}


And i get an error when i click the check syntax button.
The error goes: "Error de compilación de Microsoft JScript: Se esperaba ";" in line 7"
Line seven is where global $conn; is written.
Error would be in english: "Compilation Microsoft JScript error: ";" expected in line 7"
What am i doing wrong ???
Thanks

K
kafir41 9/6/2011

Hi,

the problem is that you are adding PHP code/language in a javascript event



Hello,
From this topic Run sql Statement via button? i'm trying to add the code in the Javascript on load event



global $conn;

if(@$_POST["sql"]=="1")

{

db_exec("update ... set...",$conn);

}


And i get an error when i click the check syntax button.
The error goes: "Error de compilación de Microsoft JScript: Se esperaba ";" in line 7"
Line seven is where global $conn; is written.
Error would be in english: "Compilation Microsoft JScript error: ";" expected in line 7"
What am i doing wrong ???
Thanks

O
orodriguez author 9/6/2011

i understand, but if you see the post i started talking about, that code worked for someone else...
check that please

Admin 9/6/2011

orodriguez,
your understanding of that post is incorrect. Besides that, that post is 5 years old and applies to really old version of PHPRunner.
In short, you cannot mix Javascript and PHP code.

O
orodriguez author 9/7/2011

We could say then that the indicated code doesn't aplly to the version of PHPr i'm using because it worked just for an old version.
Thanks anywayfor yout attention.