This topic is locked
[SOLVED]

 Button to Trigger Record Insert

12/10/2013 6:55:51 AM
PHPRunner General questions
C
CWDATA author

I have tried the following code in a Button located at the end of the rows in a list page.
global $conn;

$strSQLInsert = "insert into tblClientTabV2 (ClientName, SwitchboardPhone, Unique ID)

values (Company Name, Phone Number, Unique ID)";

db_exec($strSQLInsert,$conn);
Can anyone advise if you can use this method and if so what to a need to do to get it working.
Many thanks Carl.

Sergey Kornilov admin 12/10/2013

This code doesn't make much sense, you need to specify some real values in your SQL query to be inserted into the database.
Check this code sample that explains how to access field values of selected record:

http://xlinesoft.com/phprunner/docs/update_multiple_records.htm

C
CWDATA author 12/10/2013



This code doesn't make much sense, you need to specify some real values in your SQL query to be inserted into the database.
Check this code sample that explains how to access field values of selected record:

http://xlinesoft.com/phprunner/docs/update_multiple_records.htm


Thanks for your very prompt reply.

However I am wanting to Insert" records not Update.

The insert values will be pulled from Current List Record.

Sergey Kornilov admin 12/10/2013

Nobody is talking about updating anything.

This code doesn't make much sense, you need to specify some real values in your SQL query to be inserted into the database.

Check this code sample that explains how to access field values of selected record:

http://xlinesoft.com...ple_records.htm

C
CWDATA author 12/11/2013



Nobody is talking about updating anything.


Thanks Sergey but this example is entering a specific value i.e. 'Bob Smith'. I need this to be a variable value which I extract from a table against a specific record key.

Sergey Kornilov admin 12/11/2013



Thanks Sergey but this example is entering a specific value i.e. 'Bob Smith'. I need this to be a variable value which I extract from a table against a specific record key.


This is not correct. This example shows how you can access the value of selected record "KeyField" column via $data["KeyField"]. You can access the value of any column this way.