This topic is locked
[SOLVED]

 Seems like SQL isn't firing on my button

12/30/2017 10:58:29 AM
PHPRunner General questions
A
asawyer13 authorDevClub member

I have a View for a table. I added a Button via the insert Button feature.
I have this code in the Client Before

params["seq"] = $values["Seq"];

//ctrl.setMessage("Sending request to server...");

// Uncomment the following line to prevent execution of "Server" and "Client After" events.

// return false;
return true;


I have a field called Seq in my table.
In the Server I have

$sql = DB::prepareSQL("Update Messages set DateDeleted = now() where DateDeleted is null and Seq = 1");
DB::Exec($sql);


For testing I hardcoded the Seq = 1 just so I can test.
I also have MySQL query logging turned on so I should be able to see any SQL queries being sent to the database.
When I run the generated project and view a message, and press the Delete button, I get no error, but it appears as though the SQL statement is not actually being sent to the server, as it's not showing in the query log. It's also not updating the record in the database.
If I manually execute the SQL statement in something like phpmyadmin it works fine.
Maybe I'm doing something very simple that's not correct, but I can't figure it out so far.
Thanks

A
asawyer13 authorDevClub member 12/30/2017



I have a View for a table. I added a Button via the insert Button feature.
I have this code in the Client Before

params["seq"] = $values["Seq"];

//ctrl.setMessage("Sending request to server...");

// Uncomment the following line to prevent execution of "Server" and "Client After" events.

// return false;
return true;


I have a field called Seq in my table.
In the Server I have

$sql = DB::prepareSQL("Update Messages set DateDeleted = now() where DateDeleted is null and Seq = 1");
DB::Exec($sql);


For testing I hardcoded the Seq = 1 just so I can test.
I also have MySQL query logging turned on so I should be able to see any SQL queries being sent to the database.
When I run the generated project and view a message, and press the Delete button, I get no error, but it appears as though the SQL statement is not actually being sent to the server, as it's not showing in the query log. It's also not updating the record in the database.
If I manually execute the SQL statement in something like phpmyadmin it works fine.
Maybe I'm doing something very simple that's not correct, but I can't figure it out so far.
Thanks


As usual, once I post in the forum things start working. I tried taking it back to the simplest form and it's working so I'll add to it until I get what I need.