Jump to content

Recommended Posts

Hi,

I'm creating a web page that reads a list of users from a mysql database.

it displays as a table showing the users id then name then

at the end of each user there is an option to edit(Which goes to a diff page) or delete the user(stays on same page).

I'm having trouble in accessing the user.

the code goes as follows.

session start

connect to DB...

$result=mysql_query(SELECT*...)

$rows=mysql_num_rows($result)

for($i=0;$i<$rows;$i++)

{

$data=mysql_fetch_row($result);

echo"$data[0]";

same as above for rest of data

print"<a href=\"delete.php\"</a> | <a href=\"edit.php\"</a>;

$data[0]=$_SESSION[username];//this is the problem

}

with the last line creates only the last userid on the table as the session.

what would I need to change so if I wanted to select a user further up the table?

 

Thanks in advance

 

S

Link to comment
https://forums.phpfreaks.com/topic/51299-solved-php-sessions/
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.