Is this right? ( JOIN )

Discussion in 'MySQL' started by Agent_Smith, Aug 15, 2008.

  1. #1
    Hello,

    My query is as follows:

    SELECT * FROM `{$dbprefix}multi_admins` 
    	          WHERE `id` = '".clean_up($_SESSION['id'])."'
    			  JOIN `{$dbprefix}multi_permissions` 
    			  ON `{$dbprefix}multi_admins.id` = `{$dbprefix}multi_permissions.admin_id`
    Code (markup):
    Is there anything visually wrong with it? In my PHP file its giving mysql errors.

    If i just use the simple select from that single file, it works. Just when i add the join i get
    (This is more related to SQL than php?)
    Thanks.
     
    Agent_Smith, Aug 15, 2008 IP
  2. gcjmarkets

    gcjmarkets Peon

    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What are you trying to do?
     
    gcjmarkets, Aug 15, 2008 IP
  3. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Never mind, the guys over at phpfreaks fixed it. I had a few ` in the wrong place and some over stuff.. :p.

    SELECT * FROM `multi_admins`
               INNER JOIN `multi_permissions`
               ON `multi_admins`.id = `multi_permissions`.admin_id
               WHERE `multi_admins`.id = '" . clean_up($_SESSION['id']) . "'
    Code (markup):
     
    Agent_Smith, Aug 16, 2008 IP