Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.