Jump to content

Recommended Posts

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";

Link to comment
https://forums.phpfreaks.com/topic/74436-looking-for-a-smarter-plan/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.