Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 months ago.
Improve this question
OK, I understand the title might be little confusing. Sorry about that.
This question doesn't have anything with coding, I just want your advice on how to approach to solve this task.
I'm using Laravel 8.
I got these reports that need to be uploaded on various dates (usually at the end of every quarter) throughout every year. I want to display the reports the user hasn't uploaded, with their due date and the status.
Something like this:
All the reports have a separate Model, Controller and db tables.
So, my question is how do I check whether a certain type of report has been uploaded by the user within the required dates (or before the due date)? Any ideas?
I hope you understood my question. Thank you.
First, check if the file exists. If not, then output the necessary statement. Something like: 'Report has not been submitted"
if the file is present, check the file creation date on the server and compare it to the required dates. If it is before the due date, output "Report submitted on time". Otherwise, output "Report submitted late"
The file information can be found using stat([filename]).
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm just a beginner of PHP and I am working for making a multiple-choice type question paper. And I want to stores answers of these question in the database and also want to fetch result from database. And also I want to show result of attempt in percentage e.g. Your result is 40%.
I'm running PHP on WAMP server.
Welcome to Stack Overflow, we are here to help you correct your bugs and help you if you get stuck in coding. We are not freelancers, so please do not ask such questions which literally mean "do my homework!".
But hey, let me give you a basic info on how you should start up. First create a php page with form which contains all questions at once or like a wizard (depends on your needs). Later, you need to create a database, with two tables (maybe more) which are questions and answers. These shouldn't contains huge amounts of html chunks, but should be straight questions and answers with a foreign key to link them. Then use php to generate random questions and answers and use normal post/get (usually not user friendly) or AJAX (better performance).
If you get stuck in any of the steps above, then come back to StackOverflow and share your query with invalid codes and similar. Hoping this was helpful :)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am making a table to display data from a MySQL database, this table will display all the information for the current date but next day it will be blank again and contain no information so you can see the information only for the current day, the data will exist in the database forever however and all data can be displayed upon request!
Now you know my goal i will present the problem, i dont know how to display information for only the current day in the table.
Use data_date=CURDATE() in where condition of your select statement. data_date is your date field separating data for each date...e.g
select * from mydata where data_date=CURDATE()
this will only give the current date data as required
A quick search will bring up similar questions, with answers.
However you can use PHP's date() formatter.
Similar question
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am using laravel to build a riddle web application where user can post the riddle and set a end time (eg: 10hrs/2days from the date of post). Other members can answer the riddle within the given time. best answer within time wins. I want that the riddle will not show up in page if the time has ended.
I need guidance on how can I approach only the section where riddle is not available after the time limit. Will checking current time with posted time can help? or there is other easier way.
I am new to laravel.
Thanks in advance.
I would store are riddles in the database. You insert them and you give them a startdate, wich can be your current time... and an end date. This value is something you can set in the back-end.
When a user wants to visit a page, you do a time time check for example: (Dummy data)
The user navigates to:
www.riddles.com/112
You check if the id 112 exists. ( FindOrFail ).
Yes, it exists?
Do a check in your database for the endtime. If this end-time is not yet reached you show the page. Else you redirect to some other page.
Your question wasn't 100% clear to me but I guess that is something you would like to start doing? If not, please give a more detailed explanation.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm sure all of you have seen at some point at some website some message - i.e. you logged in and it stated something like "There will be a planned maintenance downtime at Tuesday 5PM PST". And then you have the tick mark for the message. When you click on it, you don't get the message shown any more.
Now, my question is how to handle this in the database. I.e. if you have 1M registered users and you decide to store this "seen" record for every user you'll end up with a 1M table which has to be read from every time someone logs in. On the other hand, if you have 10 messages like that - of course your table grows much faster. And finally, there could be messages like "Johnny,Harry,Diane and 5 of your other friends have updated their profile."
You could have like 10-50 messages like that daily. What I'm trying to think of is the best approach to this. I've implemented a lot of solutions in the past but I'm rethinking and am wondering of how others in the community are handling problems like that!
Edit:
#hakre
Thank you for your comment. Actually, I did describe one way I handled it in the question itself. Don't get me wrong but if I propose solutions, answers tend to discuss those proposed solutions which isn't something I'd like.
Do you have any NoSQL at hands?
I use redis, and I would create an set with all the users ids as members of the set (add the ids if the user should be marked as seen)... To check if the user has seen the message a simple SISMEMBER will suffice and it's O(1)...
Plus, you won't need any db query or alter table for the seen field.
http://redis.io/commands/sismember
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Sorry if this has been ask but i can't find anything about this on the form,
I am making a shipping calculator and i get csv files from my courier with rate and place (the calculator is made in php),my question is - what is best to read the CSV file in as an array or import the CSV to Mysql database and read the data that way?
If anyone has some experience with this type of situation and won't mine telling me the best way to go about this that will be so great.
I have not tried anything because i would like to know what the best way is to go about this.
Thanks for reading.
Won't this depend upon how many times a day you need to access the data, and how often the shipping data is updated?
eg if the shipping data is updated daily, and you access it 10000 times per day, then yes it would be worth importing it into a db so you can do your lookups.
(this is the kind of job sqlite was designed for btw).
If the shipping data is updated every minute, then you'd be best grabbing it every time.
If the shipping data is updated daily, and you only access it 10 times, then I wouldn't worry too much - either grab it an cache the file then access it as a PHP array.
Sorry, but I am not familiar with the data feed in question.