FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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.
Related topics
PHP Book (Php and Mysql for Dynamic Web Sites)
HTTP AUTH with PHP and mySQL
Make search engine With PHP and mySQL, for your site
Crash course in PHP and MYSQL
php and mysql connection in flash based website
Installing Apache Php and MySQL [newbie tutorial]
Which book is best for beginner of PHP and MySQL?
Ksiazki o PHP i mySQL, Helion
Setup your own server with Apache, PHP and MySQL [Windows]
Who is PHP and MySQL local server program best
[man]Azlo tu mismo ShoutBox en PHP y mysql
Developing a Login System with PHP and MySQL
PHP to MySQL connection
how to connect php with mysql?
php and mysql form
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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