bradgrafelman;10971102 wrote:We don't have an idea either, since we don't even know what the MySQL error is yet. See the PHP manual page for [man]mysql_query/man - the first coding example shows how you should be checking the return value of [man]mysql_query/man to handle errors. For debugging purposes, you'd want to output the value of [man]mysql_error/man when a query fails so that you can see the MySQL error message. It can also often be beneficial to output the entire SQL query string itself so you can visually inspect it.
The PHP error was very possibly due to a fundamental step that I had missed. There was a database data file os.sql, that had to be run with the command install/os.sql. I did that and the db error no longer appears (at least with the present set of code corrections)
bradgrafelman;10971102 wrote:That code doesn't define any constants - it tries to use the value of an undefined constant. You use the [man]define/man function to define a constant.
I don't know what to do. I changed it to
include_once(TEMPLATE_PATH.'error.php');
And I created error.php page where it is missing. Now the error.php file is in the following directories;
/public_html/school/openschool/error.php
/public_html/school/openschool/includes/error.php
/public_html/school/openschool/templates/oslite/error.php
/public_html/school/openschool/templates/oslite/modules/os_pages/error.php
(I assumed that the problem could also be because the file error.php is not found, so created the file, some of which are unnessary)
Now the errors are:
Warning: include_once(/home/istudio/public_html/app/templates/oslite/error.php) [function.include-once]: failed to open stream: No such file or directory in /home/istudio/public_html/school/openschool/includes/modules.php on line 91
Warning: include_once() [function.include]: Failed opening '/home/istudio/public_html/app/templates/oslite/error.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/istudio/public_html/school/openschool/includes/modules.php on line 91
The code pertaining to the error:
//Load template.
function load_template($module,$view)
{
if (file_exists(TEMPLATE_PATH.'modules/'.$module.'/'.$view.'.php'))
{
include_once(TEMPLATE_PATH.'modules/'.$module.'/'.$view.'.php');
}
elseif (file_exists(TEMPLATE_PATH.'modules/'.$module.'/index.php'))
{
include_once(TEMPLATE_PATH.'modules/'.$module.'/index.php');
}
elseif (file_exists(TEMPLATE_PATH.'index.php'))
{
include_once(TEMPLATE_PATH.'index.php');
}
elseif (file_exists(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.$view.'.php'))
{
include_once(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.$view.'.php');
}
elseif (file_exists(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.'index.php'))
{
include_once(SERVER_ROOT.APP_ROOT.'/templates/oslite/modules/'.$module.'/'.'index.php');
}
elseif (file_exists(SERVER_ROOT.APP_ROOT.'/templates/oslite/index.php'))
{
include_once(SERVER_ROOT.APP_ROOT.'/templates/oslite/index.php');
}
else
{
//next line is line 90
include_once(TEMPLATE_PATH.'error.php');
}
}
?>
Thank You for all the help so far.