0

i've successfully developed a page where i can echo a $_SESSION['SESS_MEMBER_ID'] and display the member id of a person who is logged in. however i need to display all the data of two mysql databases that are relational.

$sql = "SELECT * FROM `members`.`players` WHERE `member_id` = 3 LIMIT 0, 30 "this is the code i currently have;

I need to replace the "member_id" and the "3" to work with the $SESSIOn_Member_id by binding it to a variable and querying with it. can someone prepare this statement and revise my sql query and demonstrate the session binding to a varible?

Edited by mike_2000_17: Fixed formatting

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by waveydaveywaves
0

would you rewrite your code without tags (only the sql command) I may help you :)

0

sorry didnt realize it would do that

query("SELECT * FROM `members`.`players` WHERE `member_id` = 3 LIMIT 0, 30 ";)

0

once time the user is logged in, he has his own IDsession so you've just to replace member_id by $_SESSION then you got :

$reponse = $bdd->query("SELECT * FROM members,players WHERE ".$_SESSION['member_id']." = 3 LIMIT 0, 30 ";
$donnees = $reponse->fetch( );
echo $donnees['field1']; // display out your data
echo $donnees['field2'];
//....................
//....................
//....................
echo $donnees['field3'];
0

no theres no 3 in this coding, i need to have 3 replaced with a varible binded with session member_id. the member id is a one-one realational row in two separate tables.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.