Click to See Complete Forum and Search --> : newbie wants to know how to use PHP


Code One
11-14-2003, 05:45 PM
I don't really want to know a history of PHP or anything too indepth, all I want to know is if I download a file of PHP files, and want to use them in my html doc. How do I call for those scripts to work, is it like Javascript, were you just simply go like this: <script language="PHP" target="../my.php">
Something like that?

regards,

Code One

pyro
11-14-2003, 05:53 PM
No, actually PHP code resides between PHP tags:

<?PHP
# code here
?>

<!--OR, with short tags (not recommended)-->

<?
# code here
?>Then, name the file with a .php extention and if your server supports PHP, the code between the tags will get processed.

Code One
11-14-2003, 06:46 PM
that makes sense... thanks alot.

regards,
code one

Oh one more thing...how does the server know were to find the .php file? If the code isn't actually on the page, and his tucked away in a folder on my server, how will it kow which folder to reference? Or are u suggesting I take the PHP code from the downloaded files, and paste it within the document. Don't know if that would work, because I have one file acting as a data base. This is for a vote script, made with sql and php.

Jona
11-14-2003, 09:03 PM
The code goes inside of the .php document, and the code is run from there. If you're accessing an SQL database, you'll just use code to access that database's name, etc. via functions pre-set in PHP.

[J]ona

Code One
11-14-2003, 09:11 PM
so your saying, even if the doc, was a html doc, to begin with, if I add any PHP it should be saved as a PHP doc, instead? and if i was accessing an sql database what kind of calls should i use?

regards

Code One

pyro
11-14-2003, 10:19 PM
PHP documents do not need to reside in any specific directory. Anything with a .php extention will be processed.

Code One
11-14-2003, 10:22 PM
alright I'll give it a shot and see what happens.

thanks,

co

pyro
11-14-2003, 10:26 PM
You bet... :)