npsari Posted October 23, 2007 Share Posted October 23, 2007 I am using this long code to get statistics on how many people each day added an email, or an image, or both (hence activated) The way i done it, seems a little complicated Is there a better way, because i want to do this for the last 10 days! $Date_Today = date("Y/m/d"); $q1 = "SELECT * FROM profile WHERE Date = '$Date_Today' "; $res1 = @mysql_query($q1,$con); $All_Today = mysql_num_rows($res1); print"Today: $All_Today"; $q2 = "SELECT * FROM profile WHERE Date = '$Date_Today' AND Image1 !='' AND Email ='' "; $res2 = @mysql_query($q2,$con); $Only_Image = mysql_num_rows($res2); print"Only Image: $Only_Image"; $q3 = "SELECT * FROM profile WHERE Date = '$Date_Today' AND Email !='' AND Image1 ='' "; $res3 = @mysql_query($q3,$con); $Only_Email = mysql_num_rows($res3); print"Only Email: $Only_Email"; $q4 = "SELECT * FROM profile WHERE Date = '$Date_Today' AND Email !='' AND Image1 !='' "; $res4 = @mysql_query($q4,$con); $Activated = mysql_num_rows($res4); print"Activated: $Activated"; $Date_Yesterday = date("Y-m-d",mktime(0,0,0,date("m") ,date("d")-1,date("Y"))); $q5 = "SELECT * FROM profile WHERE Date = '$Date_Yesterday' "; $res5 = @mysql_query($q5,$con); $All_Today2 = mysql_num_rows($res5); print"Yesterday: $All_Today2"; $q6 = "SELECT * FROM profile WHERE Date = '$Date_Yesterday' AND Image1 !='' AND Email ='' "; $res6 = @mysql_query($q6,$con); $Only_Image2 = mysql_num_rows($res6); print"Only Image: $Only_Image2"; $q7 = "SELECT * FROM profile WHERE Date = '$Date_Yesterday' AND Email !='' AND Image1 ='' "; $res7 = @mysql_query($q7,$con); $Only_Email2 = mysql_num_rows($res7); print"Only Email: $Only_Email2"; $q8 = "SELECT * FROM profile WHERE Date = '$Date_Yesterday' AND Email !='' AND Image1 !='' "; $res8 = @mysql_query($q8,$con); $Activated2 = mysql_num_rows($res8); print"Activated: $Activated2"; Quote Link to comment https://forums.phpfreaks.com/topic/74436-looking-for-a-smarter-plan/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.