Hello,
I use the following code in-order to display records based on the week day.My intention behind writing this one was to display 90 records in a cyclic fashion.(i.e, first 90 on monday, next 90 on tue and so on...)
My question is - what happens if there are 1000 records???
How can i get the second weekday(Monday) displaying results from 631 onwards and so on??The condition is I want to display every day 90 records
or in other words, if i have 100 records in the table, I like to display first 90 today and from 91 to 100 and from 1 to 80 tomorrow
Is there any way to modify my code or does some body have any other alternative??
Thanks
I use the following code in-order to display records based on the week day.My intention behind writing this one was to display 90 records in a cyclic fashion.(i.e, first 90 on monday, next 90 on tue and so on...)
PHP-Code:
$today = getdate();
$day = $today['weekday'];
switch($day)
{
case "Monday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
case "Tuesday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 90,90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
case "Wednesday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 180,90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
case "Thursday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 270,90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
case "Friday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 360,90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
case "Saturday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 450,90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
case "Sunday":
$query="SELECT id,introtext,zipcode,image,telephone,description FROM tbl_personals ORDER BY id Limit 540,90";
$numresults=mysql_query($query,$connection);
$numrows=mysql_num_rows($numresults);
break;
}
How can i get the second weekday(Monday) displaying results from 631 onwards and so on??The condition is I want to display every day 90 records
or in other words, if i have 100 records in the table, I like to display first 90 today and from 91 to 100 and from 1 to 80 tomorrow
Is there any way to modify my code or does some body have any other alternative??
Thanks
Kommentar