Interview Question in SQL Server 2008


 

Interview Question :: Need help with php array


I need to set 2 arrays - "$data" and "$data2" both with the date as key. they will be accessed outside the foreach and while statments.
"$data" with the sum of clicks for each date
"$data2" with the sum of purchaces for each date.
*/
//---here is what I have so far---//
$refide=$addiliate_id;// affiliate id
$strDateFrom='2008-01-01';
$strDateTo='2008-01-07';
$aryDates=createDateRangeArray($strDat... // call function to output individual dates from $strDateFrom - $strDateTo * works fine
// if possible I would like to remove the redundant sql querys to save load on the server
foreach($aryDates as $dates) {
$sql="SELECT *, count(day) as totalclicks FROM error_clickthroughs WHERE refid='$refide' AND day='$dates' GROUP BY day ORDER BY day";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
$clicks = array_fill_keys($dates,0);
while($line = mysql_fetch_assoc($result)){$clicks[$lin... = $line['totalclicks'];}
}
Answers to "Need help with php array"
RE: Need help with php array?

Don't understand what you are asking. Please post your entire code, and any PHP console errors that you are getting.
 
Vote for this answer ::  
Update Alert Setting