S I T E  S E C T I O N S

Home
Sales
Dedicated Servers
Reseller Hosting
Virtual Private Server
Web Hosting
Support
articles
Site Design Quote
Privacy

S E C T I O N S

cpanel demo
Nameserver demo
WHM demo
Hosting Manual
Getting Started
Agora Shopping Cart
Anonymous ftp
Backup Manager
CGI Setup
CGI Centre
MS Frontpage
Ftp Help
Change Password
File Manager
Form Mail
Email
Mail List
Mime Types
MySql
Network Tools
Path Information
PGP Email
PHP information
_Directory password
Search Submit
Secure Server
SSH Telnet
_Server Side Include
Stats Overview
URL Redirection
Java
Control Panel
FAQ
Web Resources
Internet Security Alerts

PHP
PHP is a server-side, cross-platform, HTML embedded scripting language  that was developed in C and is designed for working with  relational database  systems. If you are completely new to PHP and want to get some idea of  how it works, have a look at the Introductory  Tutorial at www.php.net. Once you get beyond that have a look at the  example archive sites and some of the other resources available in their Projects section.

A PHP program is embedded directly in the HTML document. It must  have  a .phtml or .php3 or .php extension in order for the server to look for  PHP code in the document. Here is an example of how you embed the PHP:

<HTML>
<BODY>

 

<?
insert PHP code here
?>

 

</BODY>
</HTML>
 

Here is a sample PHP program shown accessing a MySQL  database.

Note, you MUST have the <? at the begining and ?> at the end.  PHP coding will not be displayed when someone views the source code  of  your file through their browser if done correctly.

<?php

mysql_connect ("localhost" , "username" , "password");
$query =  mysql_db_query("michael", "SELECT first_name from children");
$result = mysql_fetch_row($query);
$i = 0;
$check = 0;
while ($i  if ($first == $result[0]){
$check = 1;
}
if ($check == 1) {
$i = mysql_num_rows ($query) + 1;
echo "You've already made a guess!!";
}
$result = mysql_fetch_row($query);
$i++;
}
if ($check == 0) {
mysql_db_query("michael","INSERT INTO children
(last_name, first_name, kids, sex)
VALUES
('$last', '$first', '$numb', '$gender')");

?>

 To merely display the information  in your database:

<P>These are the products I sell:</P>

<TABLE BORDER="1">

<?
mysql_connect(localhost, username, password);
$result = mysql(mydatabase, "select * from products");
$num = mysql_numrows($result);
$i = 0;

while($i < $num) {
echo "<TR>n";
echo "<TD>n";
echo mysql_result($result,$i,"prodid");
echo "</TD>n<TD>";
echo mysql_result($result,$i,"name");
echo "</TD>n<TD>";
echo mysql_result($result,$i,"price");
echo "</TD>n";
echo "</TR>n";
$i++;}
?>
</TABLE>

Thus having the loop in the php program create a table with the  products listed. NOTE your username and password for the  database are not  written in the file when it's displayed on the Internet so users viewing  the source of your webpage will not see your password.

When using a CGI script to pull information  from a form which  has been submitted by a browser you must have the first line of the script  have this command on it (Much like perl scripts):

#!/usr/local/bin/php

For detailed  information regarding PHP, you can go to their online  manual: http://www.php.net/manual. PHP.net  has many links to examples and scripts. There is also a mailing list  to interact with other PHP users where you can ask questions and find useful  scripts and bits of code. You will also find books  available for  learning PHP.

[Home] [Web Hosting] [Reseller Hosting] [Virtual Private Server] [Dedicated Servers] [Sales] [Support]

Please contact our Webmaster with questions or comments.                          
©Copyright 2000 Arachno Net  All rights reserved.