FW: [PHP] (PHP) Help - What is wrong with this code - Please help
| From: | Lars Wilhelmsen | Date: | Fri, 28 Jul 2000 09:20:26 +0000 |
| Subject: | FW: [PHP] (PHP) Help - What is wrong with this code - Please help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8747@lists.php.net to get a copy of this message | ||
Read the checklist at http://zez.org/lw/phpchecklist.php3
You'll have to include global $variable - in your functions.
And you must use return $value; in order to return a value.
In your functions - ( I dunno about your last lines; $num; and $hdl; )
you'll have to declare that you want to change the global variables.
you could also pass variables as references with &$variable.
--
Lars Wilhelmsen <lw@ez.no>, developer @ eZ systems <www.ez.no>
-----Original Message-----
From: David Tandberg-Johansen [mailto:david@datajo.no]
Sent: 28. juli 2000 11:13
To: php-general@lists.php.net
Subject: [PHP] (PHP) Help - What is wrong with this code - Please help
Hello All!
I have tried for over a week now , reading from the manual (www.php.net) an
been to php.faqts.com and I still don't know what i do wrong.
Could anyone give me a hint??
David
mk_hdl.php
*********************************************
<?PHP
$hostname = "localhost";
$username = "root";
$password = "";
$dbName = "database";
$name_first ="Name";
$name_sir ="Second_name";
function get_character ($name_first ,$name_sir)
{
$rest1 = substr ($name_first , 0, 1);
$rest2 = substr ($name_sir, 0, 1);
$rest3 = "$rest1$rest2";
$rest3;
}
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to
database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
function get_number ()
{
$result = mysql_db_query($dbName, "select count(*) as kundeid from
kunder");
$num = mysql_result($result,0,"kundeid");
$num;
}
function mk_hdl ()
{
get_character($fornavn,$etternavn);
get_number();
$hdl = "$rest3$num";
$hdl;
}
echo hdl();
?>
********************************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net