NameSilo

Mysql question

Spaceship Spaceship
Watch
Impact
20
yo people

im building a web based register and im stuck basically

ive got my sql code
PHP:
SELECT * FROM `$group` ORDER BY `id` DESC

and that will display all the entrys in that table the lnk would be entrys.php?group=2017

but i want to keep the same file but to display the entrys from that day (there are 2 entrys per day)

so i would add a limit onto the end of the code but instead of a value i would give it a variable

then the link would be entrys.php?group=2017&limit=2

now i know all this but when it comes to display all the entrys i dont want to define a limit

so basucally my question is how would i get it so that i can define a limit on todays entrys but not on all the entrys?

im think abotu an IF statement but im not sure wether it would be logical or not
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Hmm maybe you could just put it into separate variables? I'm sure there's other ways, but I don't know any of them. :D


PHP:
$all_entries = "SELECT * FROM `$group` ORDER BY `id` DESC";
$todays_entries = "SELECT * FROM `$group` ORDER BY `id` DESC LIMIT 2";

Maybe ?
 
0
•••
yeh i was thinking somthing like that cheers
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back