Jump to content

Showing Specific SQL


Solar

Recommended Posts

This will be a hard one to explain, or maybe I am going over board for nothing.

 

$session = $_SESSION['username']; 

I have the session as username, Thats fine.

 

 

$sql = "SELECT id, members, friendwith userlevel FROM friends ORDER BY id DESC,id LIMIT $offset, $rowsperpage";  

Using the Pagenation script provided by PHP Freaks, works perfectly.

I want to change the "Members" to the variable to $session but it's not working properly.

 

What I want to do is list a simple friendlist using;

echo $list[''] . "<a href=\"userinfo.php?user=" . $list['$session'] . "\">" . $list['$session'] . " <br />"; 

 

So when the session = Username, change that with Members for the SQL Database which for example; $session=Steven. I really confused myself, Once again I may be going over then what I need to.

 

I'm guess my Question is, Is it possible to change the SQL statement from Members to show a specific name for eg. $session->Username?

Thanks.

Link to comment
Share on other sites

so, u want to change to this?

if $session = steven

$sql = "SELECT id, steven, friendwith userlevel FROM friends ORDER BY id DESC,id LIMIT $offset, $rowsperpage";

if this case, it is not  possible if u dont have the column named steven, u dont want to do this

i suggest adding a where clause

Link to comment
Share on other sites

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.