I am still a newbie guys will someone look at this and tell me if I am thinking on the right track.
// Creating Temp Table
mysql_query("create table counter
(ID int not null auto_increment primary key,
refkeyword varchar(100),
refrefid int(10) unsigned,
transtoneid int(10) unsigned
year varchar(4)unsigned,)")
OR die(mysql_error());
//query to find all of the records from goto and between dates
$query1 = "SELECT referrers.keywords,referrers.referrer_ID, transactions.stoneage_ID, transactions.year
FROM referrers,transactions
Where referrers.referrer = 'goto' and (referrers.timestamp between $Syear$Smonth$Sday000000 and $Eyear$Emonth$Eday235959) and referrers.referrer_ID = transactions.referrer_ID
GROUP BY referrers.keywords";
//Query to populate temp table
$query2 = "INSERT INTO counter(refkeyword, refrefid, transtoneid, year) VALUES ('$keywords', '$referrer_ID', '$stoneage_ID', '$year')";
//run 1st query
$result1 = mysql_query($query1);
//Populate temp table
while(list($keywords, $referrer_ID, $stoneage_ID, $year) = mysql_fetch_row($result1)){
$result2 = mysql_query($query2)
}
I know that is a lot of code sorry guys. But is this the best way to do this? I need to run some counts on the data in $query1 and am wondering if this is the right way.
Thanks in advance,
Steve Rodda
// Creating Temp Table
mysql_query("create table counter
(ID int not null auto_increment primary key,
refkeyword varchar(100),
refrefid int(10) unsigned,
transtoneid int(10) unsigned
year varchar(4)unsigned,)")
OR die(mysql_error());
//query to find all of the records from goto and between dates
$query1 = "SELECT referrers.keywords,referrers.referrer_ID, transactions.stoneage_ID, transactions.year
FROM referrers,transactions
Where referrers.referrer = 'goto' and (referrers.timestamp between $Syear$Smonth$Sday000000 and $Eyear$Emonth$Eday235959) and referrers.referrer_ID = transactions.referrer_ID
GROUP BY referrers.keywords";
//Query to populate temp table
$query2 = "INSERT INTO counter(refkeyword, refrefid, transtoneid, year) VALUES ('$keywords', '$referrer_ID', '$stoneage_ID', '$year')";
//run 1st query
$result1 = mysql_query($query1);
//Populate temp table
while(list($keywords, $referrer_ID, $stoneage_ID, $year) = mysql_fetch_row($result1)){
$result2 = mysql_query($query2)
}
I know that is a lot of code sorry guys. But is this the best way to do this? I need to run some counts on the data in $query1 and am wondering if this is the right way.
Thanks in advance,
Steve Rodda