Amiga Hellas Magazine 06 - Greek Retro Fanzine

Page 1


















mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql | +----------+ 1 row in set (0.00 sec)

mysql> CREATE DATABASE mydatabase; Query OK, 1 row affected (0.00 sec)

mysql> SHOW DATABASES;

cd mysql:bin mysql -u root

+------------+ | Database | +------------+ | mydatabase |


| mysql | +------------+ 2 rows in set (0.02 sec)

mysql> USE mydatabase;

mysql> CREATE TABLE admins ( admins_id tinyint(4) NOT NULL auto_increment, admins_username varchar(50) default NULL, admins_password varchar(255) default NULL, admins_realname varchar(255) default NULL, admins_email varchar(50) default NULL, admins_date date default NULL, PRIMARY KEY (`admins_id`), KEY `Id` (`admins_id`) );

Database changed Query OK, 0 rows affected (0.04sec)

mysql> INSERT INTO admins (admins_username, admins_password, admins_realname, admins_email, admins_date) VALUES ('walkero', 'aaaaa', 'George', 'walkero@yahoo.com', '2008-05-01'); Query OK, 1 row affected (0.00 sec)

mysql> SHOW TABLES; +----------------------+ | Tables_in_mydatabase | +----------------------+ | admins | +----------------------+ 1 row in set (0.02 sec)

mysql> SELECT * FROM admins; +-----------+-----------------+-----------------+-----------------+-------------------+-------------+ | admins_id | admins_username | admins_password | admins_realname | admins_email

| admins_date |

+-----------+-----------------+-----------------+-----------------+-------------------+-------------+ |

1 | walkero

| aaaaa

| George

| walkero@yahoo.com | 2007-08-01

|

+-----------+-----------------+-----------------+-----------------+-------------------+-------------+ 1 row in set (0.00 sec)


<?php echo "Test page for connection to database.<br>"; $CON = mysql_connect("localhost", "root", "") or die("Could not connect"); mysql_select_db("mydatabase") or die("Could not select database"); $getSQL = mysql_query("SELECT * FROM admins"); ?> <html> <body> <table width="100%" border="1"> <?php while($row_rs = mysql_fetch_row($getSQL)) { echo "<tr>"; echo "<td>" . $row_rs[0] . "</td>"; echo "<td>" . $row_rs[1] . "</td>"; echo "<td>" . $row_rs[2] . "</td>"; echo "<td>" . $row_rs[3] . "</td>"; echo "<td>" . $row_rs[4] . "</td>"; echo "<td>" . $row_rs[5]. "</td>"; echo "</tr>"; } ?> </table> </body> </html>






Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.