PHP site connecting to MySql on the same server.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jdfultonii
    New Member
    • Nov 2006
    • 1

    PHP site connecting to MySql on the same server.

    I have a client that is changing hosts. We have a Windows 2003 server running the latest MySQL version and PHP Version 5.1.6. The problem is I cannot seem to get the site to connect to the database. I know php and mysql is working because I have PHPMyAdmin running fine with no problems.

    Is there a way to show the error on why it isn't connecting? Also when I view the source of the page I am testing I can see all of the code. When I load the page I just get a blank page. Is this normal?

    I am new to PHP and have no clue on why this isn't working.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You must display the mysql_error after each mysql command, like this
    [php]
    mysql_connect(' localhost', 'mysql_user', 'mysql_password ')
    or die ("Cannot connect to MySQL server: " . mysql_error());
    mysql_select_db ('my data-base')
    or die ("Cannot connect to db: " . mysql_error());
    [/php]

    Ronald :cool:

    Comment

    Working...