I don't have a clue how to do this.

Have a PHP web site template, that has a 'submit ad' form. Works just fine for that web site.

What I want to do, is to include a number of additional sub-domains, so that one can run the same ad on other classified sites.
Will probably use radio buttons.

1) When one selects an additional web site, what kind of statement do I write in order for it to communicate with another db.
2) Would like to be able to have a visible ecord of this, of which would be displayed upon the client ordering such.

Is this something that I might find in a PHP book, a MySql book, either in a journal. I just don't know.

Perhaps, the form might reflect the db that it is sending information to; of which I could amend with more data bases.

Any help would be appreciated.

Regards,
Bryce

Recommended Answers

All 2 Replies

If I understand you correctly, one way you could do it would be to use a conditional IF statement to test each of the checkboxes to see if they have been selected, where each checkbox represents a different "site" on which the ad is to be displayed, and therefore a different database update.

For each checkbox that is checked, you would then create a new database connection to the correct database and insert the necessary data.

Assuming your databases are all on the same MySQL host, you would only need to use mysql_select_db() each time to select a different database and then perform the necessary data insert/update. If they are on different hosts, it's a trickier matter involving making remote connections. If you set up and manager your databases using phpMyAdmin, and all of the databases appear in the same list, then they are all on the same host.

So, basically, the answer to question 1 is that your MySQL query statement doesn't necessarily change when switching between databases (if the databases are identical, that is), you just have to "select" the desired database before issuing each query statement.

I hope that gets you started in the right direction. To get more specific would require a lot more response.

Thanks Coppercup! Appreciate the direction.

Bryce

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.