Php noob help

rward

Senior Member
Joined
Oct 26, 2007
Messages
865
Why even load that initial table from a DB (that table with the city names)? That is wasteful and should be discouraged. The more you read from the Database, the more resources will be needed. Use JSON and read the table content from the JSON file (just in case it will have to be modified) then use the modal to load the other stuff from the Database.


The speed it's going to take to do the database lookup vs a json file is neglible and with a database you have all your data in one place.

That the OP is looking to do this themselves indicates that there isn't budget for a more qualified developer to do it. This means that it's probably not a 'high priority' site with a lot of queries per second.

Plus now OP would need to identify all other places that the country is being used and change that to read from a json file instead of the existing database lookup.

Or maybe they use the json file in this one instance and keep the database table for any other references to country. But then they modify the table and forget about the file becasue it's 2 years down the line and now you have your 2 'data sources' out of sync.

TLDR:
Don't use a JSON file in this instance..
 

eternaloptimist

Well-Known Member
Joined
Jul 10, 2013
Messages
175
This is for one of my modules, I've done everything else (albeit questionable practices) and stuck on the last bit now.
 

Hamish McPanji

Honorary Master
Joined
Oct 29, 2009
Messages
42,084
This is for one of my modules, I've done everything else (albeit questionable practices) and stuck on the last bit now.
So they basically just helped you do your homework?
Isn't the purpose of the assignment actually to get you to learn something?
 

Hamish McPanji

Honorary Master
Joined
Oct 29, 2009
Messages
42,084
Nobody helped me do my homework, I asked for pointers on how to achieve something.
Point taken.

Am talking from history on this, I had taken too much assistance during my 1st year programming assignment (modula 2) and realised in the 2nd year that I didn't learn anything and so had to restart from the basics again
 

eternaloptimist

Well-Known Member
Joined
Jul 10, 2013
Messages
175
Point taken.

Am talking from history on this, I had taken too much assistance during my 1st year programming assignment (modula 2) and realised in the 2nd year that I didn't learn anything and so had to restart from the basics again

Totally agree with you, the help I generally seek is more like 'ways to approach the problem'.
 
Top