Re: PostgreSQL and HTML output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Robertson,

Try something like this with a simple table, create it like this in mysql:

CREATE TABLE HITS (
IDNR INTEGER AUTO_INCREMENT PRIMARY KEY,
REFFER VARCHAR(255),
HIT_DATE TIMESTAMP(8)
);


And the as a .php file, try something like this:
-----------------------------------------------------------------

<html>
<head><title>Simple outputpage for a MySQL-query</title></head>
<body bgcolor="#FFFFFF"  text="#000000">
<table width="100%">

<?
// Let's start the database-connection
mysql_connect('your_hostname','your_username','your_password') or
die("Unable to connect to the SQL server...");
mysql_select_db("your_database_name");


// The query
$SQL_QUESTION = "select REFFER,HIT_DATE  from HITS";
$SQL_QUERY = mysql_query( $SQL_QUESTION );


// Let's go with the query and build the table
while ($row=mysql_fetch_array($SQL_QUERY)) {
echo '<tr>';
echo '<td>'; echo $row[REFFER]; echo '</td>';
echo '<td>'; echo $row[HIT_DATE]; echo '</td>';
echo '</tr>';
}
?>

</table>
</body>
</html>

------------------------------------------------------------------

If none of this makes any sense to you please start at the beginning,
Try http://www.devshed.com for some excellent tutorials.

Good Luck,
Maarten Verheijen





----- Original Message -----
From: "Edwin Robertson" <tm@tuxmonkey.com>
To: <php-db@lists.php.net>
Sent: Friday, October 18, 2002 7:02 PM
Subject:  PostgreSQL and HTML output


> With psql you can get all your output in HTML format.  Anyone know of a
way
> to do this in PHP?
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux