Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
  1. #1
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    hey,
    what's wrong with this incredibly simple piece of code?
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <?php
    $connection 
    mysql_connect ("localhost""root" "" )
    or die( 
    "sorry - unable to connect" );
    echo( 
    "contrats, you connected" );
    ?>
    </body>
    </html>
    its really annoying me! i get this message when i try it out -
    Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mysqltest.php on line 10
    any help would be great!

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    http://www.php.net/manual/en/ref.mysql.php and http://www.webmasterworld.com/forum88/5216.htm

    By the sounds of it, PHP is looking for something (.dll) and not finding it.

  4. #3
    Senior Member leprechaun13's Avatar
    Join Date
    May 2005
    Location
    Northampton
    Posts
    487
    Member #
    10058
    have u tried mysqli instead of mysql in the function
    Regards Phil,


  5. #4
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    Are you on a windows server? Maybe you need to use mssql_connect()?
    choosy developers choose gif!
    website | paintings | blog

  6. #5
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    im on an apache server on windows, where would i put this mssql_connect()?

  7. #6
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    You would use it instead of mysql_connect().

  8. #7
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Yeah... do you even have mySQL? It say undefined which would mean you don't have mySQL.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  9. #8
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    i do have mysql, but im not sure i configured it right

  10. #9
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    well try it by replacing mysql_connect() with mssql_connect()... I had that problem once and it was because I needed to use mssql_connect() instead.

    And, it doesn't say that you don't have mysql, it says that the mysql_connect() function is undefined... So that's why I think you should try mssql_connect() instead. (And if that works, then you'd need to use all the mssql...() functions instead of mysql...() functions)
    choosy developers choose gif!
    website | paintings | blog

  11. #10
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    Having said that, I've got a WAMP testing server on my laptop and I use mysql_connect without any problem. Did you install Apache/PHP/MySQL manually, or use something like WAMP? It could be that you don't have the database running for it to work.


Page 1 of 3 1 2 3 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:46 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com