Ok here is my problem. I am trying to take results from one query and put them into a temp table then run some more queries. When I print the results of the first query it displays exactly what I want. But when I try to insert those rose into the table and then print those I get a bunch of null values. Here is some code to better see my delima.
// Temp Table
mysql_query("create table counter
(refkeyword varchar(100),
refrefid int(10) unsigned,
transtoneid int(10) unsigned,
year varchar(4)) type=HEAP")
OR die(mysql_error());
// First Query
$query1 = "SELECT referrers.keywords,referrers.referrer_ID, transactions.stoneage_ID, transactions.year
FROM referrers,transactions
Where referrers.referrer = 'goto' and (referrers.timestamp between '20010226000000' and '20010228235959') and referrers.referrer_ID = transactions.referrer_ID
GROUP BY referrers.keywords";
//Run query
$result1 = mysql_query($query1);
// Trying to populate table
while(list($keywords, $referrer_ID, $stoneage_ID, $year) = mysql_fetch_row($result1)){
print("<br>$keywords, $referrer_ID, $stoneage_ID, $year <br>");
mysql_query($query2) or die(mysql_error());
}
/*That first print statement gives out put like this
new suv, 78925, 3034367, 2001
new truck, 78662, 3033637, 2001
toyota rebate, 79868, 3037749, 2001
vw leasing, 76014, 3025012, 2001
Which is right */
//Simply trying to see if the data is getting there ok
$query3 = "SELECT * From counter";
$result2 = mysql_query($query3) or die(mysql_error());
while(list($keywords, $referrer_ID, $stoneage_ID, $year) = mysql_fetch_row($result2)){
print("<br>$keywords, $referrer_ID, $stoneage_ID, $year <br>");
}
And I get output like this
, 0, 0,
, 0, 0,
Sorry for the long post but I am really stuck and have searched the manuals for like 2 hours. Please help if you can.
Thanks,
Steve Rodda
// Temp Table
mysql_query("create table counter
(refkeyword varchar(100),
refrefid int(10) unsigned,
transtoneid int(10) unsigned,
year varchar(4)) type=HEAP")
OR die(mysql_error());
// First Query
$query1 = "SELECT referrers.keywords,referrers.referrer_ID, transactions.stoneage_ID, transactions.year
FROM referrers,transactions
Where referrers.referrer = 'goto' and (referrers.timestamp between '20010226000000' and '20010228235959') and referrers.referrer_ID = transactions.referrer_ID
GROUP BY referrers.keywords";
//Run query
$result1 = mysql_query($query1);
// Trying to populate table
while(list($keywords, $referrer_ID, $stoneage_ID, $year) = mysql_fetch_row($result1)){
print("<br>$keywords, $referrer_ID, $stoneage_ID, $year <br>");
mysql_query($query2) or die(mysql_error());
}
/*That first print statement gives out put like this
new suv, 78925, 3034367, 2001
new truck, 78662, 3033637, 2001
toyota rebate, 79868, 3037749, 2001
vw leasing, 76014, 3025012, 2001
Which is right */
//Simply trying to see if the data is getting there ok
$query3 = "SELECT * From counter";
$result2 = mysql_query($query3) or die(mysql_error());
while(list($keywords, $referrer_ID, $stoneage_ID, $year) = mysql_fetch_row($result2)){
print("<br>$keywords, $referrer_ID, $stoneage_ID, $year <br>");
}
And I get output like this
, 0, 0,
, 0, 0,
Sorry for the long post but I am really stuck and have searched the manuals for like 2 hours. Please help if you can.
Thanks,
Steve Rodda