function wont echo

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
justravis
Forum Commoner
Posts: 53
Joined: Mon Dec 16, 2002 3:18 am
Location: San Diego, CA
Contact:

function wont echo

Post by justravis »

GRRRR...cant figure y function wont echo.

No errors r give. It just wont echo.

The query works in phpmyadmin.

Any help would be greatly appreciated.

The Function:

<?php

#Outputs Author names & links to popups.
function author_list($artid, $artpg='')
{
$result = mysql_query("SELECT author.id, author.first, author.mid, author.last, author.cre
d FROM author, art_auth WHERE author.org_id='$org_id' AND art_auth.artid=$artid AND art_auth.authi
d=author.id ORDER BY art_auth.rank");

while($author = mysql_fetch_array($result))
{
$authid = $author[id];
$first = $author[first];
$mid = $author[mid];
$last = $author[last];
$cred = $author[cred];

$name = $first;

if($mid)
{
$name .= " $mid";
}

$name .= " $last, $cred";

$authors .="<a href=\"#\" onClick='authWindow($artid, $authid)'><b>$name</b></a>";

if(!$artpg)
{
if($commas<mysql_num_rows($result)-1)
{
$authors .= ', ';

$commas++;
}
else
{
$authors .= "<br>\n";
}
}
else
{
$authors .= "<br>\n";
}
}

if(!$artpg)
{
echo $authors;
}

return $authors;
}

?>

The call:

<?php

author_list($artid);

?>
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

<?
echo author_list($artid);
?>
Post Reply