I'm a bit new to this so excuse my noobness.

For the website I'm working on - I'm wondering about whether information like images, uploaded files, date of birth, edited details etc. can all be displayed on the same page (specific to the user who has logged in, not everyone sees it). Should I be doing separate tables for this? or even separate databases? If I do separate tables etc. then will I be able to call all of the relevant information from the same file of code

As far as I know you can only execute whatever you want php to do once. I.e. you have a variable $con for connection and $sql for the instructions you want it to carry out (such as INSERT db....). Then you put ($sql, $con) to execute that but if I use the variable $sql more than once then there's all sorts of weird errors.

Any relevant info will be appreciated!

Recommended Answers

All 3 Replies

If you want to modify what you show for each user, then:

  • For information that is specific to the user like birth date you should be querying the data base for a record for that user (e.g. by login id) and then displaying what is in the record. The code to do this will be the same for every user and the info would all be contained in a single table with one (or more) records for each user.
  • Users could belong to groups and the group id could be stored in each user record. This could be used to control what is displayed like images.
  • If the users have their own data like uploaded files, then you will probably want another table to track this. This table could contain the user id, the type of resource and identifying info for the resource (e.g. a file name for an image.). Each user could have multiple records in this table, one for each resource that they "own" or are linked to.

If everything is well organized, you only need one database and maybe as few as 2 tables.

I'm a bit new to this so excuse my noobness.

Welcome!

For the website I'm working on - I'm wondering about whether information like images, uploaded files, date of birth, edited details etc. can all be displayed on the same page (specific to the user who has logged in, not everyone sees it). Should I be doing separate tables for this? or even separate databases? If I do separate tables etc. then will I be able to call all of the relevant information from the same file of code

User details should go to user profile. Users table should have those info and depending limitations (one/multiple mobile number et al) will determine relational DB schema

As far as I know you can only execute whatever you want php to do once. I.e. you have a variable $con for connection and $sql for the instructions you want it to carry out (such as INSERT db....). Then you put ($sql, $con) to execute that but if I use the variable $sql more than once then there's all sorts of weird errors.

Any relevant info will be appreciated!

Actually you can execute more than once
mysql connect
do something
close
open again
.....

Ah thank you guys, I will be putting these into effect asap and see how they work out.

If anyone has other suggestions, feel free to share.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.