Link to home
Start Free TrialLog in
Avatar of CalmSoul
CalmSoulFlag for United States of America

asked on

php assistance needed

I have 3 tables

TABLE 1 COLUMNS:

`test1`(`id`, `title`, `URL`, `img`, `tagsv`

Open in new window


TABLE 2 COLUMNS:

qa_posts (type, categoryid, userid, created, title, content, tags)

Open in new window


TABLE 3 COLUMNS:

qa_postmetas (postid, title, content) 

Open in new window


- I am looking for php script which will get data from table 1
- if TABLE 1 content column value doesn't exist in qa_postmetas
THEN
- INSERT (recursively)
INSERT INTO qa_posts (type, categoryid, userid, created, title, content, tags) 
(SELECT  'Q_QUEUED', '1', '3', NOW(), f.title, f.img, f.tagsv 
FROM dev.test1 f) 

Open in new window

and then
- GET inserted postid from qa_posts and insert values from table1 in table 3

qa_postmetas (postid <-- (this is what we have just inserted in first insert),
 title, <-- this is hard coded value 'qa_q_extra'
content <-- this is coming from table 1 (URL column)
) )
Avatar of Ludwig Diehl
Ludwig Diehl
Flag of Peru image

I supposed you are talking about database tables, if so, then what kind of database ? (MySQL, MSSQL, Postgresql, etc).
Please give us more information
Avatar of CalmSoul

ASKER

I am using MYSQL

thanks
SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
its one time ...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial