简体   繁体   English

将数据传递到网站以及从网站传递

[英]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. 我正在一个项目上,在从mysql到网站以及从网站到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获取数据->旋转数据(以选择更多值)->在网站上显示此数据->计算访问次数,如果有人单击某个链接,则将其作为+1跟踪到数据库。

Mysql design for better understanding: mysql设计的更好理解:

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). 因此,当调用php / js文件时,它应返回所有参数(标题,图像)的1个变体(ID为1的参数Title为welcome1或Welcome2,ID为2的参数Image返回img1.jpg或img2.jpg)。 This data should be added to website with php echo or js document write. 此数据应通过php echo或js文档写入网站添加。 (php echo $parameter1; ). (php echo $ parameter1;)。

After that there should be onclick on link/s so I can track with which combination user clicked on link. 之后,应该在链接上单击onclick,以便我可以跟踪用户在链接上单击了哪个组合。 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. 但是,当将参数传递给JS或PHP时,还传递变量的ID,而不仅是值。 When you pass the parameters pass Title = Welcome1 TitleId = 1 Image = img1.jpg ImageId = 3 当您传递参数时,传递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 当您创建将转到其他页面的链接时,您应该创建传递给它的2个参数链接?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 在按链接计数的页面中,访问者通过按TitleId = 1和ImageId = 3的链接到达那里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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