PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Dynamic query table based on current member email

s2Member Plugin. A Membership plugin for WordPress®.

Dynamic query table based on current member email

Postby LostxSoul » July 3rd, 2011, 5:19 pm

I've been working at this for the last couple days trying to piece my query into correct code. What I'm trying to do is query the database table and show dynamic content based on the current user, sorted by email. I can get the information to pull all queried data from the specific table but I don't know the proper code to make it just the rows sorted by the current user's email.

I found the S2MEMBER_CURRENT_USER_EMAIL code but I just don't know how to implement it. For future reference to make this less complicated Email=slave_name on the table. I'm creating a form as well so they can input directly to the table and update as well but this was the content I wanted to lock since all the users would have access to see it the way it's coded now.

Any help is most appreciated! I've only been working with PHP and MySQL for a couple weeks off and on and still no where near where I want to be but I'm giving it my best shot.

Code: Select all
<?php
    
 $con 
= mysql_connect("localhost","login","password");
 if (!$con)
   {
   die('Could not connect: ' . mysql_error());
   }

 mysql_select_db("ctradec1_ranger", $con);

 $result = mysql_query("SELECT * FROM sc_slaves");

 echo "<table border='1'>
 <tr>
 <th>ID</th>
 <th>Slave</th>
 <th>Email</th>
  <th>Broker</th>
 </tr>"
;

 while($row = mysql_fetch_array($result))
   {
   echo "<tr>";
   echo "<td>" . $row['id'] . "</td>";
   echo "<td>" . $row['slave'] . "</td>";
   echo "<td>" . $row['slave_name'] . "</td>";
      echo "<td>" . $row['broker'] . "</td>";

   echo "</tr>";
   }
 echo "</table>";
 
 mysql_close
($con);
  
 ?>
Last edited by Cristián Lávaque on July 3rd, 2011, 8:42 pm, edited 1 time in total.
Reason: Improve code readability. http://www.primothemes.com/forums/viewtopic.php?f=36&t=2780
User avatar
LostxSoul
Registered User
Registered User
 
Posts: 2
Joined: July 3, 2011

Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron