View Full Version : Passing member name to a PHP script via link
thenetbox
07-15-2002, 12:43 PM
I need to be able to send the username to a script called memberspic.php to be able to display the pictures posted by that member.
How can I make a link that will send the user name to that other script? Whats the username variable?
$bbuserinfo[username] is that it? post it to the other file? or is there a better way?
thanks
Xenon
07-15-2002, 02:45 PM
if you require global.php also in your memberspic.php you can use $bbuserinfo[username] everywhere in the script ;)
thenetbox
07-15-2002, 08:24 PM
but which members name will be transfered :( ?
I need the name of the member whose profile it is to be transfered to memberspic.php
so that it can be used like this:
$result = mysql_query("SELECT image_name FROM photo_album WHERE file_name='VARIABLE OF MEMBER NAME'",$db);
if (!$result) {
echo("Sorry no Pictures: " . mysql_error(). "</p>");
exit();
}
//Display
while ($row = mysql_fetch_array($result)){
extract($row);
echo("<img src=http://www.darkforum.com/profile/images/$image_name>");
}
}
?>
Xenon
07-15-2002, 10:36 PM
$bbuserinfo[username] is always the name of the logged in user
if you want to use another username:
link to memberspic.php?username=blablabla and then use $username in memberspic.php
thenetbox
07-15-2002, 11:52 PM
Cant it automatically get the memberusername from the members profile page?
Like if I am in user "vivicas" profile
and then there is a link on the bottom saying.. look at my pictures..
cant it automatically make
$result = mysql_query("SELECT image_name FROM photo_album WHERE file_name=$membername ",$db);
into:
$result = mysql_query("SELECT image_name FROM photo_album WHERE file_name='vivica' ",$db);
by using some variable that is passed from VB to the script?
Xenon
07-16-2002, 10:34 AM
as i said, you have to pass the variable with the link to the new script
no other possibilities
thenetbox
07-17-2002, 03:29 PM
Thanks :) it works.. :) :)
now my members have a Member Picture link
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.