简体   繁体   中英

Pass data to website and from website

I'm working on one project and having problem with obtaining data from mysql to website and from website to mysql.

It's about getting data from mysql--> rotate data(to pick one value of more)--> show this on website--> count visits and if someone click on some link, track it as +1 to database.

Mysql design for better understanding:

Campaigns Table
-c_id               1             2
-name               Campaign 1    Campaign 2

Parameters Table
-p_id               1             2
-name               Title         Image
-c_id               1             1

Variations Table
-v_id               1             2           3          4
-variation          Welcome1       Welcome2   img1.jpg   img2.jpg
-p_id               1             1           2          2
-c_id               1             1           1          1

So when php/js file is called it should return 1 variation(Welcome1 or Welcome2 for parameter Title with id 1 and img1.jpg or img2.jpg for parameter Image with id 2) of all parameters(Title, Image). This data should be added to website with php echo or js document write. (php echo $parameter1; ).

After that there should be onclick on link/s so I can track with which combination user clicked on link. Problem I'm facing here is I don't know how to get and pass which elements was show on website(which variation) and also how to pass.

This will not be placed in same folder and domain as website. Only the server will be same. So I think there won't be problem with accessing database.

I'm not asking for full code of anything just for ideas how to make it the simplest way and also effective.

The database looks a little strangely built, but if that suits you then it should be fine. There are also some other things missing and I am not sure what you are trying to accomplish.

But, when passing the parameters to JS or PHP also pass the ID of the variation, not only the value. When you pass the parameters pass Title = Welcome1 TitleId = 1 Image = img1.jpg ImageId = 3

When you create the link that will take you to the other page you should create it passing to it the 2 parameters link?TitleId=1&ImageId=3

In the page that gets process with link count that the visitor got there by pressing on a link with TitleId=1 & ImageId=3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM