Insert list of items from table in PHP/MySQL

5 pts.
Tags:
MySQL
PHP
I am trying to insert list of items from dev.test1 table, but I am struggling with logic ... Face following problems: - Before insert statements I would like to add "if not exists" - select content from dev.qa_postmetas - f.URL which I am getting in second query is not coming from correct row in dev.test1 - If want to select f.URL where f.title = b.title
INSERT INTO dev.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)

LIMIT 1;

INSERT INTO dev.qa_postmetas (postid, title, content)

(select MAX(b.postid) , 'qa_q_extra',f.URL

from dev.qa_posts b

left JOIN dev.test1 as f on b.postid = f.id)

LIMIT 1 ;
Any assistance will be appreciated.


Software/Hardware used:
php
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: