I built my website from bunch of php include files that work like a template. When I change something in one file whole website changes.
When I click on a radio button, ajax should activate and it should try to communicate with the other php file which should connect to the database and to send information back to the original page, but it can’t connect to the database, since that file contains the php include function, and it would only work if I’d put content of that include file manually there. but it won’t work if it put it like this
include("includes/connect.php");
and if I manually paste content into that file like this it will work
$connect = mysql_connect("localhost","root",""); mysql_select_db("demo") or mysql_error();
is there a way to make it work with include function?
Advertisement
Answer
You’ve forgot that include
has nothing to do with client, javascript, post
.
You’re probably including file from wrong folder. Try to change
include("includes/connect.php");
to
include(dirname(__FILE__)."/includes/connect.php");
and make sure that includes/connect.php exists