How to insert parameters from url to mysql with conditions
I have the URL such as
http://site.com/somefolder?userUniqHash=d5adasd57a5gf&count=true&website=twitter&url=http://site.com/test.php&callback=JSONPSTRING1234
This URL also might exclude "website=twitter" parameter if "count=false".
I need to create index.php for "somefolder" folder to insert/update those
5 parameters into mysql(I need to create a table fields for that) with
following conditions:
userUniqHash=d5adasd57a5gf - this "d5adasd57a5gf" is Unique ID for every
registered user and all the rest 2,3,4,5 data will concern only this ID.
Another registered ID will store their own data.
count=true - a) if condition "true" I need to insert, if inserted - update
ALL 5 parameters data into mysql. b) if condition "false" - do not insert
or update.
"website=..." parameter - on every loads of the URL there could be either
the same website name "twitter", or might be "facebook" or "instagram" or
other names parameter. I need to count each website name which will be in
"website=..." parameter as well as count the TOTAL amount of all name's
counts.
The "url=" just insert/update if "count=true".
"callback=JSONPSTRING1234" - the last 4 digits (1234) generated by Rand()
and every URL load the digits are different, so I need to insert exactly
as it is "JSONPSTRING5971" on every current call.
And finally echo the TOTAL amount of all name's counts as well as echo
each website name counts. For example:
"TOTAL:33","twitter:11","facebook:11","instagram:11".
I would be so much thankful for any help on creating index.php as well as
database tables needed for that.
No comments:
Post a Comment