View Single Post
  #3 (permalink)  
Old 08-18-03, 08:47 AM
EST EST is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
that's not the whole code, here is the complete one

PHP Code:

<?php

$dbhost 
'localhost'
$dbusername 'user'
$dbpassword 'password'
$dbname 'databasename'

//Connection Function
function db_connect()
{
   @ 
$db mysql_pconnect($dbhost$dbusername$dbpassword); 
   if (!
$db)
    {
      echo 
'Could not connect to database, Please try again later.';
      exit;
    }
   @ 
$select mysql_select_db('databasename');
   if (!
$select)
    {
      echo 
'Error: Cant select database.';
      exit;
    }
}
?>
some people said it should be like this
but i've tried it, still won't work

PHP Code:

mysql_select_db($dbname$db); 


and i call this from other script throught function db_connect()

Last edited by EST; 08-18-03 at 08:50 AM.
Reply With Quote