Jump to content


mysql_connect() not working from web (Newbie)

  • Please log in to reply
2 replies to this topic

#1 BrotherLogic

  • Members
  • PipPip
  • Member
  • 22 posts

Posted 09 August 2006 - 09:19 PM

I just installed MySQL on my IIS 6.0 (Windows 2003 Server).
I am just trying certain operations to make sure MySQL server is working properly.

when I try to use the mysql_connect() function it works from command line on the server computer but not from a an http call. For example (code from test.php):

<TITLE> This is a Drag </TITLE>

$a = 0;
echo $a;
mysql_connect('localhost', 'user', 'passy');
echo $a;
mysql_select_db('wordpress') or die(mysql_error());
echo $a;

mysql_query("CREATE TABLE testerrrr(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30), age INT)")
or die(mysql_error()); 

echo $a;



from command line:

C:\PHP\php.exe C:\inetpub\wwwroot\test.php

<title> this is a drag </title>

(AND the table is created)

from www.yourname.com/test.php


(no table created)


This means that the test.php is dying when i Try to call the mysql_connect funtion.
I have tried using for localhost... localhost:port... and many other variations. Now remember I am a newbie and I might be doing something very simple wrong. It might not even be possible. Anyhow, I appreciate the input everyone!

Thanks Again.

#2 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 09 August 2006 - 09:41 PM

So this is running the same script on the same machine with the same database?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#3 BrotherLogic

  • Members
  • PipPip
  • Member
  • 22 posts

Posted 09 August 2006 - 09:43 PM

Yes, its the exact file.
From the same location on the same machine.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users