Jump to content

When using include the php code does not execute


dario

Recommended Posts

when i dont use the include function the file works as i want only i dont have any functions then, that is why i really need to include my functions file and my register.inc. i have never used include before so please help me i need to get it before tuesday because its for a school assignment.

 

when I do use the include the file only shows his code in the browser.

sorry for my english im a dutch student

 

grtz Dario

register.php

register.inc.php

functions.php

Looking at the code, you are using includes correctly. The problem that can arise is that PHP cant find the files you are trying to include and so it will either log an error in the servers error log or display an error message,

 

 

 

 

when I do use the include the file only shows his code in the browser.

But this to me sounds like you are not running your .php files correctly. I have a feeling you are loading the php files directly into your browser (eg the address bar looks like file://path/to/file.php). If this is true then this not the correct way to run PHP code on your computer.

 

To run PHP code on your computer you need to download PHP and and configue it with a http server. There are packages available you can download and install to allow you to do this. Most popular being

  • WAMP - For Windows Only
  • XAMPP - For Mac, Linux and Windows
  • MAMP - For Mac Only

Once you have installed the package for your platform you store the PHP files in the packages document root folder and then to run th php files you goto http://localhost

 

 

 have WAMP already running

Then your php files should then be stored in C:/wamp/www . You then open http://localhost to run them

 

 

 

but i have the feeling this isnt working properly

If i remember correctly, if WAMP is running there should a green wamp taskbar icon in the taskbar. If it is red or yellow then it is not running or has an encountered an error.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.