This topic is locked

Adding a table and updating records

12/5/2007 9:05:20 AM
PHPRunner General questions
N
nix386 author

Hi there, as you can tell I am a beginner with mysql and phprunner (recently purchased for a project that I am working on).

I'm not sure what I am trying to do is possible and some guidance would greatly be appreciated.
I have a _table

with the following

SID int(11) No auto_increment

edi varchar(10) latin1_swedish_ci Yes NULL

name varchar(100) latin1_swedish_ci Yes NULL

contact varchar(50) latin1_swedish_ci Yes NULL

address1 varchar(100) latin1_swedish_ci Yes NULL

address2 varchar(100) latin1_swedish_ci Yes NULL

address3 varchar(100) latin1_swedish_ci Yes NULL

suburb varchar(50) latin1_swedish_ci Yes NULL

region varchar(50) latin1_swedish_ci Yes NULL

state varchar(50) latin1_swedish_ci Yes NULL

postcode varchar(5) latin1_swedish_ci Yes NULL

mainphone varchar(50) latin1_swedish_ci Yes NULL

fax varchar(50) latin1_swedish_ci Yes NULL

email varchar(100) latin1_swedish_ci Yes NULL

type varchar(50) latin1_swedish_ci Yes NULL

comments mediumtext latin1_swedish_ci Yes NULL

updated timestamp ON UPDATE CURRENT_TIMESTAMP No CURRENT_TIMESTAMP

addrecord varchar(100) latin1_swedish_ci Yes NULL

CreatedByPHPRunner int(11) Yes NULL
What I am trying to accomplish is;

On the edit page I have a dropdown for the "addrecord" field which is using the lookup wizard to display the "edi" data from same _table.

Once an "edi" value is selected in "addrecord" field, on clicking save I want to create a new table in the database with this value if it dose not already exist.

else

update the current record and also add the same record into the new table created with the "edi" value.

Is this possible or am I barking up the wrong tree?
Many thanks in advance.
Nick

Sergey Kornilov admin 12/5/2007

Your description is a bit confusing.
Are you talking about creating a new table or about a new record?

N
nix386 author 12/5/2007

Your description is a bit confusing.

Are you talking about creating a new table or about a new record?


Yes sorry about that, I am trying to create a table firstly by using the field name selected in "addrecord"(if it dose not exist), then update the new table with the current record data.

I hope that clarifies a little.