FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

php can't connect to mysql

 


am3n
dear guys.

I got webserver box running redhat 6.2 with PHP 4.0.6 installed
also I got mysql box with mysql version 4.0.26
this week I got problem that my php apps on my webserver box can't connect to mysql box last week is oke. this is happen after I upgrade the mysql box from mysql 3.23.52a to 4.0.26

from webserver to mysql box the connection is OK
i can run and connect w/ this command

am3n@websvr$ mysql -u am3n -h sqlsvr -p

but my php apps can't !! very strange: when I check w/ phpinfo these are the information about my webserver PHP settings

Client API version 3.23.32
MYSQL_MODULE_TYPE builtin
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE
MYSQL_LIBS

can I just change the client api version into 4.0.26? and please tell me how do I do that?

how do fix this problem?
I do not want to reinstall / upgrade OS is my webserver

thx 4 ur explanation.
thnn
You may have to download either a new version of PHP or else the correct mySql php dll.
Arcath
use this code:

Code:
<?php
//First we need to setup the mysql user info
      $dbhost='localhost'; //host. normally localhost
      $dbusername='USERNAME';
      $dbuserpass='PWORDHERE';
      $dbname='DBNAMEHERE';
      
      //Now we need to connect to the db
      mysql_connect($dbhost, $dbusername, $dbuserpass);
      mysql_select_db($dbname) or die('Cannot Connect to db');
      
      //Now Lets Query It
      $query="SELECT * FROM table name WHERE Query here";
      $result=mysql_query($query) or die('Cannot Query');
      while ($row = mysql_fetch_array($result))


};
?>


now the mysql Vars you siply place all the HTML in the echo tags, and where ever you want to display something the DB place this:

'.$row['colom name (e.g. title)'].'

and that will place the data in.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.