1
50724692
problems with the usage of <{$xoops_uname}>
  • 2007/2/25 2:29

  • 50724692

  • Just popping in

  • Posts: 5

  • Since: 2006/12/22


Hello,

I have some problems with the usage of <{$xoops_uname}>.

I want to select something out from the database, but I don't know why something will be selected out after "stdID = 50724692" have been changed to "stdID =<{$xoops_uname}>".

Can everyone help me


The statements that I type in a block:
____________________________________________________________
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("fyp", $con);

$result = mysql_query("SELECT stdID FROM student
WHERE stdID =<{$xoops_uname}>");

while($row = mysql_fetch_array($result))
{
echo $row['stdID'];
echo "
";
}

mysql_close($con);
____________________________________________________________

2
Dave_L
Re: problems with the usage of
  • 2007/2/25 13:38

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


<{$xoops_uname}> is a template variable reference. It's only suitable for use in Smarty templates.

In PHP code you would obtain the current username like this:

global $xoopsUser// needed if inside a function
is_object($xoopsUser) or redirect_header('index.php'3_NOPERM); // if appropriate
$uname $xoopsUser->getVar('uname');

Login

Who's Online

421 user(s) are online (60 user(s) are browsing Support Forums)


Members: 0


Guests: 421


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits