Hello, Can someone help me with creating a script to return certain information from a Postgres database to a drop down box on a webpage?
#!/usr/bin/perl use CGI; use DBI; #Define connection values $DBSource = 'dbi:Pg:dbname=mydb'; $DBUsername = 'test'; $DBAuth = 'test'; #Open db connection $dbh = DBI->connect($DBSource,$DBUsername,$DBAuth) or die "Can't connect to SQL Database"; #Prepare and execute SQL statement $sqlstatement="SELECT $value FROM $table WHERE username LIKE '[EMAIL PROTECTED]'"; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; #Output database results to pop up menu <HTML> <BODY> <form><select name="test">; while ( my @row = $sth->fetchrow_array() ) { <option value="$row[0]">$row[0]; } </select>; </form>; </BODY> </HTML> $sth->finish; $dbh->disconnect;