SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: MySQL & PHP

  1. #1
    SitePoint Addict ozmart2004's Avatar
    Join Date
    Feb 2004
    Location
    Albury, NSW, Australia
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL & PHP

    I need a little help plse...I'm new at this so please forgive dumb mistakes :-)

    I installed MySQL Essentials 4.1 succesfully on my WinXP machine. I also installed the administrator and ODBC app.

    I then installed the Zend Studio Server V4 which also installed Apache 1.3 which is configured correctly.

    I then downloaded PHP5, unzipped it into C:/PHP and manually configured it. I left the php.ini in the PHP directory.

    So far so good......however, is there something I need to do to make PHP recognize and interact with the MySQL server? I tried to run this test script to see. Its just on my desktop - not sure if I need to put it in a certain place like with IIS??:

    PHP Code:
    <?php 
    $host
    ="localhost"
    $user="Martin"
    $password="password"

    mysql_connect($host,$user,$password); 
    $sql="show status"
    $result mysql_query($sql); 
    if (
    $result == 0
    echo(
    "<b>Error " mysql_errno() . ": " mysql_error() . "</b>"); 
    elseif (
    mysql_num_rows($result) == 0
    echo(
    "<b>Query executed successfully!</b>"); 
    else 

    ?> 
    <!-- Table that displays the results --> 
    <table border="1"> 
    <tr><td><b>Variable_name</b></td><td><b>Value</b></td></tr> 
    <?php 
    for ($i 0$i mysql_num_rows($result); $i++) { 
    echo(
    "<TR>"); 
    $row_array mysql_fetch_row($result); 
    for (
    $j 0$j mysql_num_fields($result); $j++) { 
    echo(
    "<TD>" $row_array[$j] . "</td>"); 

    echo(
    "</tr>"); 

    ?> 
    </table> 
    <?php ?>
    When I run this script in Zend Studio I get this output:

    HTML Code:
    b>Warning</b>: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in <b>C:\Documents and Settings\Martin\Desktop\mysql_up.php</b> on line <b>11</b><br /> 
    <br /> 
    <b>Warning</b>: mysql_query(): Access denied for user 'ODBC'@'localhost' (using password: NO) in <b>C:\Documents and Settings\Martin\Desktop\mysql_up.php</b> on line <b>13</b><br /> 
    <br /> 
    <b>Warning</b>: mysql_query(): A link to the server could not be established in <b>C:\Documents and Settings\Martin\Desktop\mysql_up.php</b> on line <b>13</b><br /> 
    <b>Error 1045: Access denied for user 'ODBC'@'localhost' (using password: NO)</b>
    I'm not really sure what do do now..maybe I'm missing something obvios....any suggestions plse?

    Thks
    Martin

  2. #2
    SitePoint Member
    Join Date
    Mar 2005
    Location
    RUSSIA
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    afaik, you should use another interface for MySQL 4.1, "mysqli".

    mysqli_connect(params);
    mysqli_query(params);

    and so on. just read the docucemtation on these new mysqli functions


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
  •