Mysql join issues

Hey there :blush:

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 :heart:

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?

1 Like




Hey @skawid :blush:
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:

$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:

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

Hope this helps :heart:

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

1 Like

Hey @benanamen :blush:

Sending it now…thank ya so very much!!! :heart:

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.

1 Like

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

You should probably start with learning Database Normalization.

2 Likes
Sponsor our Newsletter | Privacy Policy | Terms of Service