This topic is locked
[SOLVED]

 Php Error Page for Syntax Error

7/25/2011 12:46:54 AM
PHPRunner General questions
I
imthebest author

I put following sql statement in "Before Record Process" event --
$strSQLExists = "select from groupmaster where groupname =" .$values["groupname"];
I checked the syntax in phprunner and got the message that "Syntax OK."
After Build, when I executed the program, I get the Php Error page with the informatio that there is syntax error in SQL statement. Below is detail error page.

Please advise, what is going wrong?
php error happened
Technical information

Error type 256

Error description 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 '' at line 1

URL localhost/bb_project/output/pinnumber_add.php?

Error file C:\wamp\www\bb_project\output\include\dbconnection.php

Error line 36

SQL query select
from groupmaster where groupname =

C
cgphp 7/25/2011

To access specific field value use $data:

$strSQLExists = "select * from groupmaster where groupname ='" . $data["groupname"] . "'";
I
imthebest author 7/25/2011



To access specific field value use $data:

$strSQLExists = "select * from groupmaster where groupname ='" . $data["groupname"] . "'";



Nope cgphp. It is not working. I put the above codes. This time getting another issue - Undefined variable data.
However, I can following statements on the top of "Before Record Added" event
Description

Occurs before new record is added

Return true if you like to proceed with adding new record, return false otherwise.
Parameters

$values - array of values to be written to the database.

To access specific field value use $values["FieldName"]

"dict" is an alternate name for this parameter.

$message - place the message to be displayed into this variable.

$inline - equals to true when the Inline Add in process, false otherwise
That is the reason I used $values instead of $data.

Please advice.

C
cgphp 7/25/2011



Nope cgphp. It is not working. I put the above codes. This time getting another issue - Undefined variable data.
However, I can following statements on the top of "Before Record Added" event
Description

Occurs before new record is added

Return true if you like to proceed with adding new record, return false otherwise.
Parameters

$values - array of values to be written to the database.

To access specific field value use $values["FieldName"]

"dict" is an alternate name for this parameter.

$message - place the message to be displayed into this variable.

$inline - equals to true when the Inline Add in process, false otherwise
That is the reason I used $values instead of $data.

Please advice.


You wrote "Before Record Process" in the beginning.

I
imthebest author 7/25/2011

Oops! I am Sorry. It is in "Before Record Added" event.
Please advice, what is wrong in syntax?

C
cgphp 7/25/2011

The sysntax seems right. Check if groupname is the real name of the field.

I
imthebest author 7/25/2011

Once again checked. groupname is indeed a real field in mysql database. I am pasting table structure from phpmyadmin below --
groupmaster

Field Type Null Default Comments

groupid int(11) No 0

orgid int(11) No 0

groupname varchar(50) No
Indexes: Keyname Type Cardinality Field

PRIMARY PRIMARY 7 groupid

orgid

C
cgphp 7/25/2011

Is groupname a field of the add page ?

I
imthebest author 7/26/2011

Yes, Cgphp. The issue is same as you pointed out. The field name on Add page is mentioned as "Groupname". "G" is capital here. Perhaps it is case sensitive. I made "G" as caps in the sql statement and issue resolved.
Thanks for providing the direction.