Jump to content

[SOLVED] Is this overkill?


soycharliente

Recommended Posts

I have my db setup like this:

 

 

users

id

username

password

email

lastlogin

firstname

userid

firstname

lastname

userid

lastname

 

phone

userid

phone

room

userid

room

im

userid

screenname

type

 

 

I'm using this query:

<?php
$query = "SELECT firstname.firstname, lastname.lastname, im.screenname, im.type, room.room, phone.phone
FROM users
JOIN firstname
JOIN lastname
JOIN phone
JOIN im
JOIN room
WHERE users.id=firstname.userid
AND users.id=lastname.userid
AND users.id=phone.userid
AND users.id=im.userid
AND users.id=room.userid";
?>

 

My question is, is this query overkill? Can it be cleaned up at all? Is there a faster way to get the same data?

Link to comment
https://forums.phpfreaks.com/topic/66552-solved-is-this-overkill/
Share on other sites

If you're going to be storing all of that information about each user, you might as well stick it all in the same table. I would guess the only possible need for a separate table would be a table listing all of the types of instant messengers - you'd then store an ID of the IM client in the user table.

 

Personally, im not sure id even bother with that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.