Saturday, April 6, 2013

Php and HTML

PHP and HTML

<a href="https://yoursite address here">Name of your site</a> -adds a link to the given site address
<? php -starts the php interpreter
?> - stops the php interpreter
<title>Title</title> - sets the title of your web page
<br /> -line break

Script to start a SQL session:
<?php                                   -Start the interpreter
$dbhost = 'localhost';           -sets the address for the database
$dbname = 'publications';    - Selects the name of the database to use
$dbuser = 'root';                  - Selects the database user name to use
$dbpass = 'root';                  - Selects the password of the database to use 

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); -connects to the database using    credentials, if unable to connect script
will end.
mysql_select_db($dbname) or die(mysql_error()); - selects the database to use in mysql, if unable to connect, script will end.

?>

No comments:

Post a Comment