brazza Posted August 27, 2003 Share Posted August 27, 2003 It\'s a script for geeklog. but i want it in a normal php script. <?php function phpblock_randomQuote() { global $_CONF; $result = DB_query(" SELECT * FROM quote ORDER BY RAND() LIMIT 1 "); $res = DB_fetchArray($result); $author = ($res[\'author\']) ? $res[\'author\'] : \'anonymous\'; $source = ($res[\'source\']) ? $res[\'source\'] : \'\'; if ($source != \'\' && $res[\'year\'] != \'\') { $year = ", {$res[\'year\']}"; } else { $year = \'\'; } $link = "<a target=\'new\' title=\'$source $year\' href=\'http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=" . $author . "\'>" . $author . "</a>"; $authorLink = ($author != \'anonymous\') ? $link : \'anonymous\'; $retval = <<<EOF <table> <tr> <td>"{$res[\'quote\']}"</td> </tr> <tr> <td align="right">-- <b>$authorLink</b></td> </tr> </table> EOF; return $retval; } ?> [/code] Link to comment https://forums.phpfreaks.com/topic/948-this-script-in-php-how-to/ Share on other sites More sharing options...
shivabharat Posted August 28, 2003 Share Posted August 28, 2003 Try this http://www.phpfreaks.com/tutorials/51/0.php Link to comment https://forums.phpfreaks.com/topic/948-this-script-in-php-how-to/#findComment-3213 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.