₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,080 members, 8,420,202 topics. Date: Thursday, 04 June 2026 at 01:26 PM

Toggle theme

Php Error - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingPhp Error (336 Views)

1 Reply (Go Down)

Php Error by dodoisk(op): 9:10am On Mar 14, 2021
guy am having issues in php. Am building a result checking website. How do i make the expiring date to be once even after the user login so many times

Re: Php Error by salvationproject(m): 9:48am On Mar 14, 2021
Simple...
Wen u accept a PIN as valid, check if it has been used before. if yes, no need to create another record on db with expiry date but if the PIN has not been used before, then, create a record with expiry date...

I hope u get...
Re: Php Error by Karleb(m):
I believe the issue you are having is that you have different tables for student and pin, which is actually a very good design.

What you need is to join the students table to the pins table and check if a student has an existing record in the pins table, if it exists you do nothing or you update, if it doesn't you create a new record.

This would bring us primary and foreign keys.

Your students table should have a primary key which should auto increment, now this primary key would be stored in the pins table. That means, whenever you create a student record a new pin record is created for the new student automatically.

I hope it solves your problem.




Let me do a little code review here. grin


You don't need to declare a variable before you use it in latest versions of PHP.

A variable is enough for all the alert messages.

I also believe switch statement will do better than that long if else elseif logic.

As for the date logic, you can use date('Y-m-d') without assigning to a variable.

The $expire_date variable could be written properly as:

$expire_date = date('Y-m-d', strtotime('next year'));
Re: Php Error by Nobody: 9:40am On Mar 16, 2021
Why not build your result checker app in OOP? PHP is moving from procedural programming and you will find it really stressful when you have to add more features to your app later on.


————————————————————

I just checked. Looks like a mix of OOP and Procedural.
1 Reply

I'm Getting An Error While I Run This Python CodesWho Can Decipher This Error For Me?I Keep Getting This Error Message "Gradle Project Syn Failed...234

Do You Use Steroids, If So What Kind?Eastwest Properties - Property For SaleI Need A Legit Adsense Seller Asap