MySQL database:
A collection of tables, usually they are related in some manner.
In todays web hosting environment it is possible to host multiple
websites under one main account. In this case I would recommend
a seperate database for each site..as well as seperating the forum
and/or photo galleries in their own database.
Each hosting site offers their own menu system for administrators
...In my current setting
I just press a button that says "Create New database". I then supply
description, user ID and password and there you go a new database.
The MySQL database would be what iseries programmers
would call a library.CRTLIB
Once the database is created then in my case I use
phpmyadmin to create new table within this database.
I supply the new table name and the number of fields
in my example the table will be mytest...with 5 fields
This would be to an iseries developer --
create DDS then compile...or create SQL table
to read from this table we would do something like this
A collection of tables, usually they are related in some manner.
In todays web hosting environment it is possible to host multiple
websites under one main account. In this case I would recommend
a seperate database for each site..as well as seperating the forum
and/or photo galleries in their own database.
Each hosting site offers their own menu system for administrators
...In my current setting
I just press a button that says "Create New database". I then supply
description, user ID and password and there you go a new database.
The MySQL database would be what iseries programmers
would call a library.CRTLIB
Once the database is created then in my case I use
phpmyadmin to create new table within this database.
I supply the new table name and the number of fields
in my example the table will be mytest...with 5 fields
PHP Code:
CREATE TABLE `mytest` (
`field1` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`field2` TEXT NOT NULL ,
`field3` SMALLINT( 5 ) NOT NULL ,
`field4` DECIMAL( 30 ) NOT NULL ,
`field5` TIMESTAMP NOT NULL
) TYPE = MYISAM COMMENT = 'this is my test';
This would be to an iseries developer --
create DDS then compile...or create SQL table
to read from this table we would do something like this
PHP Code:
<?php
//Connect To Database
$hostname="&DBSERVER";
$username="&DBUSER";
$password="&DBPASSWORD";
$dbname="&DATABASE";
$usertable="&TABLE";
$yourfield = "&FIELD2";
mysql_connect($hostname,$username, $password)
OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db($dbname);
$query = "SELECT * FROM $usertable";
$result = mysql_query($query);
if($result) {
while($row = mysql_fetch_array($result)){
$name = $row["$yourfield"];
echo "Name: ".$name;
}
}
?>