Jump to content

function GetReason2() doesn't exist


otuatail

Recommended Posts

<?
// YBC Malawi Version 1.0.0   30-03-2009   Desmond O'Toole.
require("../secure/SecureFunctions.php");
require("secure/SecureFunctionsBank.php");
session_start();
Session_Init();
$page = "Libray Selection";

if(!isset($_SESSION["Pk"]))
{
  header('Location: index.php');
  exit;
}

$Pk = $_SESSION["Pk"];
if(KeyCheckX($Pk)== 0)
{
  header('Location: index.php');
  exit;
}

// $res = connected();

if(isRoguebot($Browser) == 1)
  exit;

$_SESSION["K9"] =  isRobot($Browser);

if($_SESSION["current_page"] <> $page && $_SESSION['Event_Log'] == "YES")
{
   // StoreData($page);
   // mailtoX($page,"Desmonds New Site.",""); 
}
$_SESSION["current_page"] = $page;


$filename = filename($_SERVER['PHP_SELF']);
$Update = date("D d-M-Y H:i", filectime($filename));

$DD = date('d');
$MM = date('m');
$YYYY = date('Y');

//if($_SESSION["DD_NEW"] == "")
  $_SESSION["DD_Balance"] = $DD;
//if($_SESSION["MM_NEW"] == "")
  $_SESSION["MM_Balance"] = $MM;
//if($_SESSION["YYYY_NEW"] == "")
  $_SESSION["YYYY_Balance"] = $YYYY;

//if($_SESSION["DD_NEW"] == "")
  $_SESSION["DD_Entry"] = $DD;
//if($_SESSION["MM_NEW"] == "")
  $_SESSION["MM_Entry"] = $MM;
//if($_SESSION["YYYY_NEW"] == "")
  $_SESSION["YYYY_Entry"] = $YYYY;

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Pages Home</title>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="imagetoolbar" CONTENT="no">
<meta http-equiv="refresh" content="60">
<link rel="stylesheet" href="stylesheets/Library.css" type="text/css">
<link rel="stylesheet" href="stylesheets/LibraryMenu.css" type="text/css">
</head>

<body>

<div id="PageTitle">
	<img src="images/LibraryBanner.jpg" alt="">
</div>

<?
 include('LibraryMenu.php');
?>

<div id="PageContent">
<form action="Redirector.php" method="post">
<h3>User: <?=greeting()?></h3>

    <div style="width:750px;height:50px;padding:10px;overflow:hidden">
        <div style="width:200px;height:50px;float:left;">Carried forward: £<span style="color:red;"><?=$_SESSION['Error_3']?></span>
        <input type="text" maxlength="10" name="BF" value="<?=$_SESSION['C_Forward']?>" size="8"></div>

       <div style="width:240px;height:50px;float:left;">
           <div style="width:440px;float:left;">Date:
           <input style="text-align:right;" type="text" maxlength="2" name="DD_Balance" value="<?=$_SESSION["DD_Balance"]?>" size="1"> /  
           <input style="text-align:right;" type="text" maxlength="2" name="DD_Balance" value="<?=$_SESSION["MM_Balance"]?>" size="1"> / 
           <input style="text-align:right;" type="text" maxlength="4" name="YYYY_Balance" value="<?=$_SESSION["YYYY_Balance"]?>" size="4"> 
           <span style="color:red;"><?=$_SESSION['Error_4']?></span></div>
        </div>       
    <input class="MyButton"type="submit" name="MainBalance" value=" Prev Balance ">
    </div>
    <div style="width:750px;height:200px;border:solid;padding:10px;overflow:hidden">
       <div style="width:240px;height:50px;float:left;">
           <div style="width:440px;float:left;">Entry Date:
           <input style="text-align:right;" type="text" maxlength="2" name="DD_Entry" value="<?=$_SESSION["DD_Entry"]?>" size="1"> /  
           <input style="text-align:right;" type="text" maxlength="2" name="MM_Entry" value="<?=$_SESSION["MM_Entry"]?>" size="1"> / 
           <input style="text-align:right;" type="text" maxlength="4" name="YYYY_Entry" value="<?=$_SESSION["YYYY_Entry"]?>" size="4"> 
           <span style="color:red;"><?=$_SESSION['Error_5']?></span></div>
        </div>       
        <div style="width:200px;height:50px;float:left;clear:both">Money in:    £<span style="color:red;"><?=$_SESSION['Error_6']?></span>
        <input type="text" maxlength="10" name="MoneyIn" value="<?=$_SESSION['Money_In']?>" size="8"></div>

        <div style="width:200px;height:50px;float:left;clear:both">Money Out: £<span style="color:red;"><?=$_SESSION['Error_7']?></span>
        <input type="text" maxlength="10" name="MoneyOut" value="<?=$_SESSION['Money_Out']?>" size="8"></div>

               
        <div style="width:280px;height:50px;float:left;clear:both;">Reason: <span style="color:red;"><?=$_SESSION['Error_7']?></span>
        <select name="Reason">
        <? $qReason = GetReason2();
        while($row = mysql_fetch_array($qReason))
        {
        ?>
        <option value="<?=$row['ReasonID']?>" <? if($_SESSION['MyReason'] == $row['ReasonID']) {?> selected <? }?>><?=$row['Reason']?></option>
        <? } ?>
        </select>
        </div>  

    </div>
</div>
</form>
</div>
</body>
</html>

Hi I am trying to populate a drop down box from a database table. When I tried I got no entries. I renamed a function from GetReason() to GetReason2() which does not exist. I should get an error. The problem is it doesn't go into the real function. The function is in Secure/SecureFunctions/Bank.php 

 

the code is at the bottom line 112 - 121.

 

Thanks.

 

 

Link to comment
Share on other sites

 

I renamed a function from GetReason() to GetReason2() which does not exist. I should get an error.

PHP wont show errors unless you have enabled PHP's error reporting. Try adding the following two lines at the top of your script (or enable the those settings within your php.ini)

ini_set('display_errors', 1);
error_reporting(E_ALL);

 

The function is in Secure/SecureFunctions/Bank.php

In your code you are including a file called SecureFunctionsBank.php (no forwardslash before Bank.php) on line 3

require("secure/SecureFunctionsBank.php");

Are you sure that is the correct path?

Link to comment
Share on other sites

Fatal error: require(): Failed opening required 'secure/SecureFunctionsBank2.php' (include_path='.:/usr/share/pear:/usr/share/php') in /vhost/vhost15/d/e/s/desmond-otoole.co.uk/www/bank/DataInput.php on line 4

Yes the path is correct and the php file is SecureFunctionsBank.php if I rename it to SecureFunctionsBank2.php I get the following error. Errors are on.

Link to comment
Share on other sites

Fatal error: Call to undefined function GetReason2() in /vhost/vhost15/d/e/s/desmond-otoole.co.uk/www/bank/DataInput2.php on line 19
<?
// YBC Malawi Version 1.0.0   30-03-2009   Desmond O'Toole.
require("../secure/SecureFunctions.php");
require("secure/SecureFunctionsBank.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Pages Home</title>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="imagetoolbar" CONTENT="no">
<meta http-equiv="refresh" content="60">
<link rel="stylesheet" href="stylesheets/Library.css" type="text/css">
<link rel="stylesheet" href="stylesheets/LibraryMenu.css" type="text/css">
</head>
<body              
        <div >
        <select name="Reason">
        <? $qReason = GetReason2();
        while($row = mysql_fetch_array($qReason))
        {
        ?>
        <option value="<?=$row['ReasonID']?>" <? if($_SESSION['MyReason'] == $row['ReasonID']) {?> selected <? }?>><?=$row['Reason']?></option>
        <? } ?>
        </select>
        </div>  

    </div>
</div>
</body>
</html>

I have created a test file and reduced it all down to the above. I don't get an error GetReason2() not found. If I remove the iner <div></div> I now get

Link to comment
Share on other sites

MY .htacces file
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on

Hi I am trying to populate a drop down box from a database table. When I tried I got no entries. I renamed a function from GetReason() to GetReason2() which does not exist. I should get an error. The problem is it doesn't go into the real function. The function is in Secure/SecureFunctions/Bank.php 

And here is the function which I am NOT calling

function GetReason() // E2001
{
	$sqlList = "SELECT * FROM EventLog";
	echo $sqlList;
	exit;
	$qList = mysql_query($sqlList);
	return $qList;
}

Here is the code for GetReason but as I explained earlier I am trying to call a function that DOES NOT EXSIST. You say that is why I get the error. Wrong. I don't get the error.

 

This was the original post ... I later discovered that if I right click and view source it is there. errors are on. If I rename one of the required files at the top I get "Can't open input stream". Does this mean that errors are on if so. why do I have to right click and view source to see

 

echo MySQLstament;

exit;

Link to comment
Share on other sites

I see what you mean now. You don't see the error message because it is output between the html <select></select> tags. The browser will not show any text between these tags, unless it is between the <option> tags. This is why you have to right click view source to see the error message.

 

If you had called the GetReason function before the <select> tag then you will see the error message, eg your code was

<? $qReason = GetReason(); ?>
<select name="Reason">
<?
while($row = mysql_fetch_array($qReason))
{
?>
    <option value="<?=$row['ReasonID']?>" <? if($_SESSION['MyReason'] == $row['ReasonID']) {?> selected <? }?>><?=$row['Reason']?></option>
<? } ?>
</select>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.