Jump to content

Recommended Posts

Hello im just beginner on this side.

 

Here what im trying to do but not successful  :shrug:

 

SELECT m.memberid, p.memberid, p.uploaded, p.downloaded, p.total_posts, p.invites_left, p.points  FROM tsue_members m, tsue_member_profile p WHERE p.memberid=m.memberid

 

 

query work but i want to get memberid diferent for every member

 

Say im logged im see my stats user logged hes see hes stats.

 

Thanks 

Link to comment
https://forums.phpfreaks.com/topic/259870-need-litle-hellp-on-sql-query-and-php/
Share on other sites

here result of this query

 

memberid 	memberid 	uploaded 	downloaded 	total_posts 	invites_left 	points
2 	2 	1073741824 	0 	3 	1 	25
3 	3 	1073741824 	0 	0 	1 	10
4 	4 	1073741824 	0 	0 	1 	10
5 	5 	1073741824 	0 	0 	1 	10
6 	6 	1073741824 	0 	0 	1 	10
7 	7 	1073741824 	0 	0 	1 	10
8 	8 	1073741824 	0 	0 	1 	10
9 	9 	1073741824 	0 	0 	1 	10
10 	10 	1073741824 	0 	0 	1 	13
11 	11 	1073741824 	0 	1 	1 	18
12 	12 	1073741824 	0 	0 	1 	16
13 	13 	1073741824 	0 	0 	1 	10
14 	14 	1073741824 	0 	0 	1 	10
15 	15 	1073741824 	0 	0 	1 	10
16 	16 	1073741824 	0 	0 	1 	10
17 	17 	1073741824 	0 	0 	1 	10
18 	18 	1073741824 	0 	0 	1 	10
19 	19 	1073741824 	0 	0 	1 	10
1 	1 	50000 	10000 	6 	10 	1133
20 	20 	0 	0 	0 	0 	3

You will have to tie your MySQL query to your PHP code, i.e. insert the currently-logged-in user's id into the MySQL query:

 

SELECT m.memberid, p.memberid, p.uploaded, p.downloaded, p.total_posts, p.invites_left, p.points  FROM tsue_members m, tsue_member_profile p WHERE p.memberid=m.memberid AND p.memberid="3";

 

where the 3 is the user id of the user.

SELECT m.memberid, p.memberid, p.uploaded, p.downloaded, p.total_posts, p.invites_left, p.points  FROM tsue_members m, tsue_member_profile p WHERE p.memberid=m.memberid AND p.memberid='$get_my_id';

 

In php if you know what im mean.

 

and what results does this query give you

well if im use session im getting this

 

Database Error!
Please try again later or contact an Administrator.
(1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 

When you login a user you need to store the user ID in a session. In some pseudo-code;

if (login == successful) {
$_SESSION['user_id'] = $row['user_id'];
}

 

At the very top of each script, put session_start() so that you can access the session.

 

In your query, do something like

SELECT m.memberid, p.memberid, p.uploaded, p.downloaded, p.total_posts, p.invites_left, p.points  FROM tsue_members m, tsue_member_profile p WHERE p.memberid=m.memberid AND p.memberid='$_SESSION['user_id']';

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.