SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Beginners problem!
-
Jul 2, 2001, 16:35 #1
- Join Date
- Jul 2001
- Location
- Sesimbra/Portugal
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Beginners problem!
I just installed PHP and mySQL on my machine (win2k).
The PHP test script is working ok.
I was able to create the sql database and tables, but when I try to run the example to connect php and sql :
<html><body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb", $db);
$result = mysql_query("SELECT * FROM users", $db);
printf("First Name: %s<br>\n", mysql_result($result, 0, "first"));
printf("Last Name: %s<br>\n", mysql_result($result, 0, "last"));
printf("Address: %s<br>\n", mysql_result($result, 0, "address"));
printf("Company: %s<br>\n", mysql_result($result, 0, "company"));
?>
</body></html>
I get a error message like this:
Warning: Can't create TCP/IP socket (10106) in C:\Program Files\BadBlue\PE\mysql.php on line 3
Warning: MySQL Connection Failed: Can't create TCP/IP socket (10106) in C:\Program Files\BadBlue\PE\mysql.php on line 3
Warning: Supplied argument is not a valid MySQL-Link resource in C:\Program Files\BadBlue\PE\mysql.php on line 4
Warning: Supplied argument is not a valid MySQL-Link resource in C:\Program Files\BadBlue\PE\mysql.php on line 5
Warning: Supplied argument is not a valid MySQL result resource in C:\Program Files\BadBlue\PE\mysql.php on line 6
First Name:
Warning: Supplied argument is not a valid MySQL result resource in C:\Program Files\BadBlue\PE\mysql.php on line 7
Last Name:
Warning: Supplied argument is not a valid MySQL result resource in C:\Program Files\BadBlue\PE\mysql.php on line 8
Address:
Warning: Supplied argument is not a valid MySQL result resource in C:\Program Files\BadBlue\PE\mysql.php on line 9
Company:
What's wrong? Is it some configuration problem?
(by the way badblue is a little server software that i'm running)
-
Jul 2, 2001, 17:26 #2
- Join Date
- Jul 2001
- Location
- Missouri
- Posts
- 3,428
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
it's not connecting to MySQL, that's what the first 2 Warnings are. the others are from you trying to run a query and get its results on a non-existent connection.
you don't have a password specified in mysql_connect. try changing that to mysql_connect('localhost', 'root', 'yourpassword').
-
Jul 2, 2001, 23:19 #3
- Join Date
- Apr 2001
- Location
- BC, Canada
- Posts
- 630
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
also, if u installed it on your own computer sometimes all u need is local host, no username or password... well thats how it was when I installed it (mysql)
-
Jul 3, 2001, 06:09 #4
- Join Date
- Jul 2001
- Location
- Sesimbra/Portugal
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's Working
I had two problems, 1st the mysql socket in php.ini was wrong, and second the mysql wasn't starting as it should nut it's all fixed now
Tks for the help
Bookmarks