Hii,
I have a include file in which I have a few functions. For one of these function I need to get certain configuration settings stored as fields in a mysql database. However my database connection code inside the function seems to work as long as it is outside the function. The moment I put the code into the function it starts revolting with : "Warning: Supplied argument is not a valid MySQL-Link resource in /var/www/kunal/WIMS/includes/billCalc.php on line 34"
My code for the function (that is line 33 onwards ) is :
function calculateAmt($myCurrItemQua, $myCurrItemRate, $myEvent){
mysql_select_db($database_wims, $wims);
$query_payConfig = "SELECT * FROM price_config WHERE STATUS = '1' AND PRI_CONFIGEVENT ='".GetSQLValueString1($myEvent,"text")."'";
$RecpayConfig = mysql_query($query_payConfig, $wims) or die(mysql_error());
$row_RecpayConfig = mysql_fetch_assoc($RecpayConfig);
$totalRows_RecpayConfig = mysql_num_rows($RecpayConfig);
switch($row_RecpayConfig["PRI_CONFIGUSAGE"]){
case "2":
//has to be billed at the that moment
//will have to proceed with payment gateway
//if(txtTotItems
return $myCurrItemQua.", ".$myCurrItemRate."<br/>";
//return "hello";
break;
case "0":
//has to be billed at the end of month
//just find out the costs and add it without a corresponding invoice id to the table.
//echo "hello2";
return "hello2";
break;
}
}
i also have at the top of the code :
require_once('Connections/wims.php');
this connection file looks like
<?php
FileName="Connection_php_mysql.htm"
Type="MYSQL"
HTTP="true"
$hostname_wims = "localhost";
$database_wims = "databasename";
$username_wims = "username";
$password_wims = "password";
$wims = mysql_pconnect($hostname_wims, $username_wims, $password_wims) or die(mysql_error());
?>
Thanks for your help in advance.
Regards,
Kunal