Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

mysql to postgres migration blues...
Hi,
I am trying to get skilled up on postgres and decided to port a little
movie database I wrote for mysql with php to access it.
I used an auto converter for the bulk and then tried to tweak. The
following code does not work but the error message it gives me is
strange. It tells me that the connection string used on line 82 (where
it calls pg_query in makelistboxentries) is invalid... but the same
string/connection works just great in another script... any pointers
appreciated.
Cheers
Antoine


<?php

/* Connect to database */
$link = pg_connect("dbname=movies host=localhost user=anton
password=password")
or die("Could not connect : " . pg_result_error($link));

print <<<TII
<div id=mybody>
Search by:
<BR>
<TABLE border="1" cellpadding="10" cellspacing="10"><TR>
<TD align="center">
ID:
<form name="input" action="searchout.php" method="post">
<input type="text" name="mychoice">
<input type=hidden name = wherestring value=" t1.ID = ">
<input type=hidden name = othertable value="movies">
<input type="submit" value="Submit">
</form>
</TD>
<TD align="center">
Name:
<form name="input" action="searchname.php" method="post">
<input type="text" name="mychoice">
<input type="submit" value="Submit">
</form>
</TD></TR>
</TABLE><BR>
<TABLE border="1" cellpadding="10" cellspacing="10"><TR>
TII;
makelistboxentries("Audio Language", "lang", "lang", " audio ", "
t2.movie = t1.ID and t2.lang = ");
makelistboxentries("Subtitle Language", "lang", "lang", " subtitles ",
" t2.movie = t1.ID and t2.lang = ");
makelistboxentries("Genre", "Genre", "Genre", " moviegenre ", "
t2.movie = t1.ID and t2.genre = ");


print <<<TINI
</TD>
</TR></TABLE>
<br><br>
<P>Show All:</P>
<form name="input" action="allout.php"
method="post">
<input type="submit" value="Submit">
</form>
</div>
<div id=mymenu>
<P><A href="index.php"><H3>Back to main page</H3></A></P>
<P><A href="movie.php">Add a movie</A></P>
<P><a href="audio.php">Add a movie's audio languages</a></P>
<P><a href="subtitles.php">Add a movie's subtitle languages</a></P>
<P><a href="searchin.php">Search the movies</a></P>
</div>
TINI;
/* Close connection */
pg_close($link);

function makelistboxentries($title, $mytable, $mycolumn, $othertable,
$wherestring)
{

print "<TD align=\"center\">";

print "$title:";
/* Perform SQL query */
$query = "SELECT $mycolumn FROM $mytable";
$result = pg_query($link,$query)
or die("Query failed : " . pg_result_error($link));
print "<form name=\"input\" action=\"searchout.php\" method=\"post\">";
print "<SELECT NAME=\"mychoice\">";
print "<option value=\"zz\" SELECTED>Select $title</option>";
while ($line =  pg_fetch_array($result,$result_countt++,
PGSQL_ASSOC)) {
foreach ($line as $col_value) {
print ("<OPTION VALUE=\"".$col_value."\">");
print $col_value;
print ("</OPTION>");
}

}
print "</select>";
print "<input type=hidden name = wherestring value=\"$wherestring\">";
print "<input type=hidden name = othertable value=$othertable>";
print "<input type=\"submit\" value=\"Submit\">";
print "</form>";

pg_free_result($result);
}

?>



--
G System, The Evolving GUniverse - http://www.g-system.at

Report this thread to moderator Post Follow-up to this message
Old Post
Antoine
09-23-04 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:24 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.