Hi,

I'm having a bit of a hard time passing in a constant to a user-defined
function.

the calling page - index.php:
<html>
<?php
include define_foo.php;
function_foo(bar);
?>
</html>

define_foo.php:
<?php
function foo($value)
{
global $value, $page_id, $usr, $pass, $database, $host;

//pull info from info table specific to type
$sql="select text, link from info where page_id = $page_id and value =
$value";
$link_id = mysql_pconnect($host, $usr, $pass) or die (mysql_error());
mysql_select_db($database, $link_id);
$result = mysql_query ($sql, $link_id) or die (mysql_error());

//set titleblock specific to type of info being output
if ($value == "bar") {$titleblock = "Bar Items"; }
if ($value == "eek") {$titleblock = "Eek Items"; }

echo "value is $value"; //this is printing as "value is" with no $value.

echo "<h2>$titleblock</h2><br>";

if (is_null($result)) break;

//iterate through array, outputting info based on value type
if ($value != "bar")
        {
        while (list ($text, $link) = mysql_fetch_row ($result))
                        {
                        echo "<a href=\"$link\">$text</a><br>";
                        }
        }
elseif ($value ="eek")
        {
        while (list ($text, $link) = mysql_fetch_row ($result))
                        {
                        echo "$text<br>";
                        }
        }
}
?>

any pointers much appreciated!!!

cheers,
jaxon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to