Jump to content

Recommended Posts

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):

<html>
<TITLE> This is a Drag </TITLE>
<?PHP



$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;

?>

<\html>



from command line:

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

output:
<html>
<title> this is a drag </title>
0000
</html>

(AND the table is created)


from www.yourname.com/test.php
output:

0

(no table created)

--------------------------------------

This means that the test.php is dying when i Try to call the mysql_connect funtion.
I have tried using 127.0.0.1 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.
Jon
Link to comment
https://forums.phpfreaks.com/topic/17102-mysql-problem/
Share on other sites

Try to put [code] or die(mysql_error())[/code] after the connect function and see if an error is returned. Another problem might be that you ran it from command line first, that created the table, then tried on the server, but then it can't create it because it already exists.
Link to comment
https://forums.phpfreaks.com/topic/17102-mysql-problem/#findComment-72317
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.