Reputation: 3712
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?
Upvotes: 0
Views: 85
Reputation: 45
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.
Upvotes: 1