0

I have a php function that I call from javascript through ajax. In that php function, I want to call a php file. Is this possible? The php file that I would like to call has html.

The php file to call looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Calendar DB</title>
</head>

<body>

<div id="debug" title="Calendar Update" style="background:white; width:640px; height:580px; color:#404040; overflow:hidden; border: 4px solid #404040; margin:0 auto;">
<div>Liturgical Calendar Generation</div>

<?php

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

function get_year() {
    $year = date("Y");
    return $year;
}

create_liturgical_calendar($year);

function create_liturgical_calendar($year) {

}

mysql_close($con);

?> 
</div>
</div> 

</body>
</html>

The php where the file should be called looks like this:

global $dbco;
global $db_liturgical;
mysql_select_db($db_liturgical, $dbco);

$qliturt = "SELECT * FROM calendar WHERE year ='$year'";
$rliturt = mysql_query($qliturt);
$num_rows = mysql_num_rows($rliturt);
if ( $num_rows < 350 ) {
/* call php file */
}

Can the php file be called where shown?

1
  • 3
    include 'your/php/file.php'; Commented Jan 21, 2014 at 2:58

2 Answers 2

1

You should use mysqli or PDO for more secure database transactions using prepared statements.

You can use include() to include the file, but there are many other errors with your code. There are multiple variables undefined, your function is empty, and you're using globals.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use include 'filename.php' or you can use require

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.