Like to learn php Database, don't how

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Thu Jan 09, 2003 2:12 pm

Hi shebul :)

Do you have all software installed??
Mysql
php
Apache
(I recommend using Mysql-front database editor as well)

Do you have any knowledge level of php ??

To start -->
the database has three rows :
id --> autoincrement - not null - primary - index - unique - unsigned
name --> varchar - 50
email --> varchar - 50
php script:

Code: Select all

<?php
$server = "localhost" ;
$login = "your_login" ;
$pass = "your_pass";
$table = "your_table";
$bbdd = "your_database";
$db=mysql_connect($server,$login,$pass);     
mysql_select_db($bbdd,$db);

$sql="select * from ".$table." order by id desc";
$result=mysql_query($sql,$db);

while ($row = mysql_fetch_array ($result)) {
   echo $row["id"]."\n";
             echo $row["name"]."\n";
             echo $row["email"]."\n";
}
?>
This file should be placed in the htdocs directory C:/Apache Group/Apache/htdocs
Then go to your browser and type:
http://localhost/my_file_name.php
That's it.
bye!

greg
New php-forum User
New php-forum User
Posts: 11
Joined: Wed Nov 13, 2002 6:56 am

Tutorial

Postby greg » Thu Jan 09, 2003 7:27 pm



Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron