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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -