SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member AMC's Avatar
    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)

  2. #2
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    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').

  3. #3
    SitePoint Guru
    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)

  4. #4
    SitePoint Member AMC's Avatar
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •