MySQL --> PostgreSQL with PHP

Поиск
Список
Период
Сортировка
От Helgi Örn Helgason
Тема MySQL --> PostgreSQL with PHP
Дата
Msg-id AANLkTinPv2CroNaZndDdeaPG6T6nGnKz-3Psjih3d_da@mail.gmail.com
обсуждение исходный текст
Ответы Re: MySQL --> PostgreSQL with PHP
Список pgsql-novice
Hi!
I've been trying to convert this PHP-query thing that I used to run on
the project I am moving from MySQL to Postgres. I've done as good as I
can but it just doesn't work. I believe my MySQL --> Postgres
translation is to blame.
There is no error message in the browser.
Anyone who can spot what I'm doing wrong here?

-----------------------------------------------------------------------
<?php

// Producing simple table output with PostgreSQL
// Show from timmar in an HTML <table>

function displayTimmar($result)
{

print "<h3 align=center>Arbetstider - Ekolådans Packavdelning</h3><br />\n";

// Start a table, with column headers
print "\n<table>\n<tbody>\n<tr>\n" .
"\n\t<th style>ID</th>" .
"\n\t<th>Datum</th>" .
"\n\t<th>Vecka</th>" .
"\n\t<th>Dag</th>" .
"\n\t<th>P|T|S</th>" .
"\n\t<th>Namn</th>" .
"\n\t<th>Tid in</th>" .
"\n\t<th>Tid ut</th>" .
"\n\t<th>Lunch</th>" .
"\n</tr>";

// Until there are no rows in the result set, fetch a row into
// the $row array and ...
 while ($row = @ pg_fetch_row($result))
{

// Start a TABLE row
print "\n<tr>";

// Print out each of the attributes in that row as a
// separate TD (Table Data).
foreach($row as $data)
print "\n\t<td> {$data} </td>";

// Finish the row
print "\n</tr>";

}
// Then, finish the table
print "\n</tbody>\n</table>\n";
}

$query = "SELECT * FROM timmar";

// Connect to the PostgreSQL server
if (!($connection = @ pg_connect($hostName, $username, $password)))
die("Cannot connect");
if (!(pg_select_db($databaseName, $connection)))
showerror( );

// Run the query on the connection
if (!($result = @ pg_query ($query, $connection)))
showerror( );

// Display the results
displayTimmar($result);
?>
-----------------------------------------------------------------------
--
PostgreSQL 8.4.4, Ubuntu Linux 10.04, Firefox 3.6.10

В списке pgsql-novice по дате отправления:

Предыдущее
От: Thangalin
Дата:
Сообщение: Re: PostgreSQL data types mapped Java classes for JDBC
Следующее
От: Mark Kelly
Дата:
Сообщение: Re: MySQL --> PostgreSQL with PHP