# Php post mySQL info to webpage

**URL:** <https://forum.kirupa.com/t/php-post-mysql-info-to-webpage/102213>\
**Category:** Uncategorized\
**Created:** [February 20, 2004, 10:54pm UTC](https://forum.kirupa.com/t/php-post-mysql-info-to-webpage/102213 "2004-02-20T22:54:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lacuna](https://avatars.discourse-cdn.com/v4/letter/l/edb3f5/32.png) [@Lacuna](https://forum.kirupa.com/u/Lacuna)\
**Post date:** [February 20, 2004, 10:54pm UTC](https://forum.kirupa.com/t/php-post-mysql-info-to-webpage/102213/1 "2004-02-20T22:54:49Z")

</div>

Hey All,

I’ve searched and searched and can’t find this answer.

How do I grab all of the emails from a database on my server and post them onto a webpage in a list like:

[serethablaze@hotmail.com](mailto:serethablaze@hotmail.com); [meagain@hotmail.com](mailto:meagain@hotmail.com); and so on…

Thanks in advance, I just cant get it right…

~ Seretha :love:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 12:13am UTC](https://forum.kirupa.com/t/php-post-mysql-info-to-webpage/102213/2 "2004-02-21T00:13:23Z")

</div>

well you have to connect to the database , get the results from the table and then echo it out… in a longer verison…

```php

<?
//some settings
	$dbname = "email_list_DB";
	$dbhost = "localhost";
	$dbuser = "root";
	$dbpass = "";
	$limit = "40";
// ___________
// connect to DataBase
$link = mysql_connect($dbhost, $dbuser, $dbpass) or die("Error!");
	mysql_select_db($dbname, $link) or die("Error!");
// ___________
// get the list
$select = "SELECT id, email FROM email_table order by id asc";
$result = mysql_query($select);
$nrows = mysql_num_rows($result);
// sdraw HTML00
echo"EMAIL LIST :";
echo"<br>";
    for ($z=0; $z < $nrows; $z++) {
	    $row = mysql_fetch_array($result);
		echo"<b>EMAIL ADDRESS : </b>".$row[2]."";
		echo"<br>";
	}
//end of it	
?>

```

hope it helps.
