# Mysql join issues

**URL:** <https://www.phphelp.com/t/mysql-join-issues/34115>\
**Category:** MySQL database\
**Created:** [October 18, 2021, 2:34am UTC](https://www.phphelp.com/t/mysql-join-issues/34115 "2021-10-18T02:34:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mekaboo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@Mekaboo](https://www.phphelp.com/u/Mekaboo)\
**Post date:** [October 18, 2021, 2:34am UTC](https://www.phphelp.com/t/mysql-join-issues/34115/1 "2021-10-18T02:34:14Z")

</div>

Hey there 😊

Im having a few code issues that stem from what is going on in my mysql (phpmyadmin). I have a main table with my login/register and tried to connect other tables with INNER JOIN but things are not working. What am I doing wrong?

Thank ya ❤

---

<div class="post-metadata">

**Author:** ![skawid](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@skawid](https://www.phphelp.com/u/skawid)\
**Post date:** [October 18, 2021, 7:20am UTC](https://www.phphelp.com/t/mysql-join-issues/34115/2 "2021-10-18T07:20:16Z")

</div>

It’s impossible to help without some more info about what you’re doing. Can you post your db setup including table structure and some sample data, the query that’s not working, and a description of what data you want returning?

---

<div class="post-metadata">

**Author:** ![Mekaboo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@Mekaboo](https://www.phphelp.com/u/Mekaboo)\
**Post date:** [October 18, 2021, 3:01pm UTC](https://www.phphelp.com/t/mysql-join-issues/34115/3 "2021-10-18T15:01:59Z")

</div>

![Screenshot 2021-10-18 at 10-31-48 phpMyAdmin dbs3781610](https://www.phphelp.com/uploads/default/original/2X/9/9556508bccd259e4a094f551b0fbcea5726d0802.png)  
 ![Screenshot 2021-10-18 at 10-33-50 MUJAL](https://www.phphelp.com/uploads/default/original/2X/d/d48e9ceb66794dc9d4601bcdbfe7553f9be213b4.png)  
 ![Screenshot 2021-10-18 at 11-21-33 https www mujal com](https://www.phphelp.com/uploads/default/original/2X/3/3e2aa7581f644fd0fe3c56bf5e44c4f1f6746ffc.png)  
 ![Screenshot 2021-10-18 at 10-34-56 MUJAL](https://www.phphelp.com/uploads/default/original/2X/d/daf73f0e41448a0a7ee9601f666fb34c4977a0a6.png)

Hey @skawid 😊  
The DB image is all the tables I’m using. Tbl\_member is the main table(login/register). Trying to connect the other tables to it so when folks join their info flows within each.  
The “Welcome Meka” & “About Me” pics have issues that go with this line of code:

```auto
$posts = $con->query("SELECT p.*,concat(u.username) as name,u.profile_pic from posts p inner join users u on u.id = p.user_id where p.type = 0 order by unix_timestamp(p.date_created) desc");
			while($row=$posts->fetch_assoc()):

```

The “Manage Account” issue goes with this line of code:

```auto
$user = $conn->query("SELECT * FROM user where id =".$_GET['id']);
foreach($user->fetch_array() as $k =>$v){
	$meta[$k] = $v;
}

```

Hope this helps ❤

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [October 18, 2021, 5:06pm UTC](https://www.phphelp.com/t/mysql-join-issues/34115/4 "2021-10-18T17:06:29Z")

</div>

If you can PM me an SQL dump of your DB I will take a look at it.

---

<div class="post-metadata">

**Author:** ![Mekaboo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@Mekaboo](https://www.phphelp.com/u/Mekaboo)\
**Post date:** [October 18, 2021, 6:33pm UTC](https://www.phphelp.com/t/mysql-join-issues/34115/5 "2021-10-18T18:33:03Z")

</div>

Hey @benanamen 😊

Sending it now…thank ya so very much!!! ❤

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [October 18, 2021, 11:20pm UTC](https://www.phphelp.com/t/mysql-join-issues/34115/6 "2021-10-18T23:20:37Z")

</div>

Based on the DB dump you sent…

There is no table named _posts_, it is _post_. There is no column in the users table named _profile\_pic_

Your DB design need some work. You are duplicating and triplicating data. For example, you have an email column in three different tables.

---

<div class="post-metadata">

**Author:** ![Mekaboo](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@Mekaboo](https://www.phphelp.com/u/Mekaboo)\
**Post date:** [October 19, 2021, 12:01am UTC](https://www.phphelp.com/t/mysql-join-issues/34115/7 "2021-10-19T00:01:05Z")

</div>

So what do I do? How to go about fixing things

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [October 19, 2021, 12:03am UTC](https://www.phphelp.com/t/mysql-join-issues/34115/8 "2021-10-19T00:03:13Z")

</div>

You should probably start with learning _Database Normalization_.
