Results 1 to 5 of 5

Thread: [RESOLVED] MYSQL Won't work at all

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    8

    Resolved [RESOLVED] MYSQL Won't work at all

    Hey guys, as the title says, MYSQL isn't working.

    Using home computer (XP) to build a website, and its my first time using MYSQL. I have apache (2.2.3) and PHP (5.2.0) working fine, and decided to include a database for this site I'm doing. So i downloaded MYSQL (5.0.27), and installed it, expecting it to work as easily as apache and PHP have done in the past, but no, it wants to be different.
    I try to connect, but doesn't seem to get past there:
    Code:
    <?php
    echo "hello"; //This is displayed.
    $con = mysql_connect("localhost","username","password");
    echo "hi"; //It doesn't reach here, meaning something is wrong with above line.
    //more code
    ?>
    Yes i have completely switched off the firewall, made sure the username/password is correct, etc etc.
    I also read somewhere that...
    Code:
    <?php
    phpinfo();
    ?>
    ...would display information relating to MYSQL if installed, but it only brings up PHP info.

    I have now installed it at least 8 times over the past few days, each time making sure the previous installed files/registry settings are gone, rebooting afterwards, and even using guides to make sure I'm doing it properly. No luck so far. Anyone have any ideas?
    There are probably better places to ask this, but what the hell

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: MYSQL Won't work at all

    try looking at the error messages generated by apache in error.log, or just use:
    Code:
    $con = mysql_connect("localhost","username","password") or die(mysql_error());
    a call to phpinfo() will just tell you if the libraries are installed, and they are included by default (in 4 at least, haven't dabbled in 5 so I'm not sure if it comes with it or not -- but I assume so).

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: MYSQL Won't work at all

    It will tell you if the PHP extension is installed, to be precise - and I'm not sure if this is the default case in 5.2.x.

    What you really should change are your error reporting settings in PHP. If it dies with a fatal error, it should emit an error message. Check the error_reporting value in your php.ini.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: MYSQL Won't work at all

    Look for a MySql section in the phpinfo() output. If its not there you need to enable the extension.

    You also need to ensure that you have installed mysql and the root installation directory is in the PATH environment variable or the libmysql.dll is in the Windows directory.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    8

    Re: MYSQL Won't work at all

    Thanks for your help guys - mistake realised!

    Cheers.

Posting Permissions

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



Click Here to Expand Forum to Full Width