PostgreSQL/mySQL: connecting, login code problem.

This is a discussion on PostgreSQL/mySQL: connecting, login code problem. within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hey, Hours ... I am searching I have these code and we found it's postgreSQL. Now we have mysql, isn'...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2004
Tekker
 
Posts: n/a
Default PostgreSQL/mySQL: connecting, login code problem.

Hey,
Hours ... I am searching
I have these code and we found it's postgreSQL.
Now we have mysql, isn't it possible to change the connect code and let it
connect
to my mysql ?
My dB is there alrdy I just need this template to use the dB.

CODE
function l2dp_connect( $database )
{
return pg_connect( "host=localhost user=test dbname=$database
password=blabla");
}




This ain't working for me. Allthoug not for me

CODE
function l2dp_connect( )
{ //PAS ONDERSTAANDE AAN !!!!

$database_url = "mysqlhost"; // URL van je database
$gebruiker = "";// gebruiker van je database
$wachtwoord = ""; // wachtwoord van je database
$database = "lin2_"; // de naam van de db

mysql_connect($database_url, $gebruiker, $wachtwoord); //
maakt verbinding met de databse
mysql_select_db($database);
}



This is the whole code, maybe you guy's understand this faster then I do,
I'm kinda roockie in PHP, but for sure in postgreSQL.
It should work cause others used this code alrdy with mysql.


CODE
<?php

function ***_header()
{
global $***_lang;

if ( isset( $_GET['language'] ) )
{
setcookie( 'language', '', time()-3600, '/' );
setcookie( 'language', $_GET['language'], time()+3600*24*30, '/' );
$l2dp_lang = $_GET['language'];
}
else
{
if ( isset( $_COOKIE['language'] ) )
{
$***_lang = $_COOKIE['language'];
}
else
{
setcookie( 'language', '', time()-3600, '/' );
setcookie( 'language', 'e', time()+3600*24*30, '/' );
$***_lang = 'e';
}
}

echo <<<EOD
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"
xml:lang="en-US">
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="***.css" rel="stylesheet" type="text/css"/>

EOD;
}

function l2dp_body()
{
echo "</head>\n";
echo "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\"";
echo " vlink=\"#FF00FF\" alink=\"#FF0000\">\n";

if ( strstr( $_SERVER['REQUEST_URI'], '?' ) )
{
$base = $_SERVER['REQUEST_URI'] . '&';
}
else
{
$base = $_SERVER['REQUEST_URI'] . '?';
}
echo "<table border=0 width=100%><tr><td>";
echo "<a href=\"index.php\">[home]</a>";
echo "<td align=right><a href=\"" . $base .
"language=e\">English</a> - ";
echo "<a href=\"" . $base . "language=k\">Korean</a> - ";
echo "<a href=\"" . $base . "language=j\">Japanese</a> - ";
echo "<a href=\"" . $base .
"language=c\">Chinese</a></td></tr><table><br>\n";
echo "<table width=740 border=0 cellpadding=0 cellspacing=0>";
echo "<tr><td width=\"100%\">\n\n";
}

function l2dp_footer()
{
echo "</td></tr></table><p>"
. "<a href=\"http://***">***</a> data from "
. gmdate('Y-M-d H:i:s \U\T\C', time() ) . "</p>\n";
echo "</body></html>";
}

function ***_connect( $database )
{
return pg_connect("host=localhost user=tester dbname=$test_");
}

function l2dp_disconnect( $db_conn )
{
pg_close( $db_conn );
}

?>



Thanks a ton alrdy.


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:55 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0