php - Error with mysql_select_db -


i use linux debian

local lamp server

i tried make connection between database , php :

<?php $tf_host = 'localhost' ;  $tf_dbname = 'tinyforum' ;  $tf_username = 'root'; $tf_password = '' ;  $tf_handle = mysql_connect($tf_host , $tf_username , $tf_password);  if (!$tf_handle) die('connection problem ..'); $tf_db_result = mysql_select_db($tf_dbname); if($tf_db_result) { mysql_close($tf_handle); die('selection problem'); }  die('ok'); mysql_close($tf_handle); ?> 

the result :

http://www.foxpic.com/v0hrsdgb.png

pic of phpmyadmin:

http://www.foxpic.com/v0alrhi6.png

the place save php file :

/var/www/html/

unless copied code incorrectly, check not going result in want.

$tf_db_result = mysql_select_db($tf_dbname); if($tf_db_result) 

your selection seems fine either should change code to

if(!$tf_db_result) //note ! 

or restructure code

if($tf_db_result) {      //do stuff want when connected } else {   //die connection } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -