SitePoint Sponsor

User Tag List

Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 86
  1. #51
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, Thank you very much!

    What will that do?

  2. #52
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I get this error when I go there now:


    No Database Selected




    That help?

  3. #53
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It means it could not use the database you specified.

    make sure the variable $db is set to the name of your database, if it's not set to anything, set it.

  4. #54
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I have one, and I even dubled checked, and it still doesn't work!

    Any other ideas?

  5. #55
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ask the guy who set up your mySQL database for you to confirm the following information:

    Your mySQL username
    Your mySQL password
    Your mySQL host (ask if it localhost or something else)
    Your mySQL database name

  6. #56
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I will ask AlexC right away, and see if that is all messed up!


    I hope I get this working...

  7. #57
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please?


    Thanks,
    ~someonewhois

  8. #58
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No body wants to help me?

    OK, fine!



    Thanks,
    ~someonewhois

  9. #59
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In accesscontrol.php

    dbConnect("coaster_coastert");

    the arguement passed to dbConnect should be the name of your database

    dbConnect("yourDbName");

  10. #60
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much!

    I will try that soon!

    Thanks,
    ~someonewhois

  11. #61
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I fixed that and it still doesn't work!

  12. #62
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok - here's what to do. First of all, put the following script on your webserver - save it with the name phpinfo.php

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    	<title>PHP Info</title>
    </head>
    <body>
    <?php
    echo ( phpinfo() );
    ?>
    </body>
    </html>
    Then copy the link to that page here - we can then tell you if MySQL is actually running.

    Now put up another script called dbconnect.php on your webserver

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    	<title>Database Connect</title>
    </head>
    <body>
    
    <?php
    
    $server = "server name e.g. localhost";
    $username = "database username";
    $password = "database password";
    $database = "database name";
    
    if ( !$dbcnx = @mysql_connect($server, $username, $password) ) {
       echo ( "<p>Error1: <b>connecting</b> to database: " . mysql_error () . " - check \$server, \$username and \$password are <b>all</b> correct" );
    } else if ( !$selectdb = mysql_select_db($database) ) {
       echo ( "<p>Error2: <b>selecting</b> database: " . mysql_error () . " - <b>\$database is wrong</b> - \$server, \$username and \$password <b>are correct!</b>" );
    } else {
       echo ( "<h1 align=center>Connected to database successfully!!!</h1>" );
    }   
    ?>      
    </body>
    </html>
    Edit the variables;

    $server - this is your database server name. You might be able to use just localhost, if it's on the same server as your webserver. It may be somethink else like "db.yourdomain.com:3306" - ask your hosting provider for the DNS name and port number for the MySQL server

    $username - this is your MySQL username - this will probably not be the same as the name you use to ftp to your webserver. Ask your host for your MySQL user name

    $password - as with username, this is probably not the same as your ftp login. Ask your host for your MySQL user password

    $database - this is the name of your MySQL database on the MySQL server. Ask your host for the name of your MySQL database - this is not the same as the MySQL server name.

    Once you have all those, put them in dbconnect.php right here;

    Code:
    $server = "server name e.g. localhost";
    $username = "database username";
    $password = "database password";
    $database = "database name";
    Point your browser at http://www.yourdomain.com/dbconnect.php and see if it works. If not, copy the exact error message and past it here. We can then tell you what the problem is.

  13. #63
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by HarryF
    Ok - here's what to do. First of all, put the following script on your webserver - save it with the name phpinfo.php

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    	<title>PHP Info</title>
    </head>
    <body>
    <?php
    echo ( phpinfo() );
    ?>
    </body>
    </html>
    Then copy the link to that page here - we can then tell you if MySQL is actually running.

    Now put up another script called dbconnect.php on your webserver

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    	<title>Database Connect</title>
    </head>
    <body>
    
    <?php
    
    $server = "server name e.g. localhost";
    $username = "database username";
    $password = "database password";
    $database = "database name";
    
    if ( !$dbcnx = @mysql_connect($server, $username, $password) ) {
       echo ( "<p>Error1: <b>connecting</b> to database: " . mysql_error () . " - check \$server, \$username and \$password are <b>all</b> correct" );
    } else if ( !$selectdb = mysql_select_db($database) ) {
       echo ( "<p>Error2: <b>selecting</b> database: " . mysql_error () . " - <b>\$database is wrong</b> - \$server, \$username and \$password <b>are correct!</b>" );
    } else {
       echo ( "<h1 align=center>Connected to database successfully!!!</h1>" );
    }   
    ?>      
    </body>
    </html>
    Edit the variables;

    $server - this is your database server name. You might be able to use just localhost, if it's on the same server as your webserver. It may be somethink else like "db.yourdomain.com:3306" - ask your hosting provider for the DNS name and port number for the MySQL server

    $username - this is your MySQL username - this will probably not be the same as the name you use to ftp to your webserver. Ask your host for your MySQL user name

    $password - as with username, this is probably not the same as your ftp login. Ask your host for your MySQL user password

    $database - this is the name of your MySQL database on the MySQL server. Ask your host for the name of your MySQL database - this is not the same as the MySQL server name.

    Once you have all those, put them in dbconnect.php right here;

    Code:
    $server = "server name e.g. localhost";
    $username = "database username";
    $password = "database password";
    $database = "database name";
    Point your browser at http://www.yourdomain.com/dbconnect.php and see if it works. If not, copy the exact error message and past it here. We can then tell you what the problem is.
    The error was:

    Error1: connecting to database: Access denied for user: 'coasterthrills@localhost' (Using password: YES) - check $server, $username and $password are all correct


    Ok, so what does that mean?

    Also, I have already done the phpinfo thing...

  14. #64
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It means that one (or may be more) of these three variables is wrong;

    1. $server - you're using localhost - is the database running on the same server as your web server? And is it running on the default mysql port number 3306? Check with host.

    2. $username - you're using coasterthrills - is that the correct name for your database user (remember - the login you use to access your site - for ftp or the control panel may be different to the database username). Check with host.

    3. $password - the password for the database user may be wrong. Check with your host.

    The easiest thing to do now is to send the dbconnect.php script, complete the values you've entered in it and ask them what's wrong.

    Keep on trying (and keep on posting! - you're starting to looking like a serious contender to beat the "Kevins Tutorial Thread")

  15. #65
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I already checked with Alex, and he says everything is fine!

  16. #66
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK so what you should have in the script right now is this;

    $server = "localhost";
    $username = "coasterthrills";
    $password = "******";

    One question - are there any of the following characters in your password?

    Apostrophe: '
    Backslash: \
    Quotes: "

    Any of those are likely to make problems for MySQL. And watch out for spaces as well. If you have any of those, suggest you get the password changed.

    Otherwise show Alex the latest script, give him the link to it running on your server and "Your problem mate" - either he's given you false information or there's a problem in the MySQL configuration / user setup.

  17. #67
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I'M A MORON! :(

    Ok, simple as this!

    I messed up completly!

    I had the databse name what should have been the user name, and the database was different!

    I played around with that dbconnect.php file, and finally got it to work!

    Thanks for everthing all!

    Thanks,
    ~someonewhois

  18. #68
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But it still says "No database selected" when I try to sign up!

    The database is all set, I can connect to it, and I can seem to get it to work in other scripts!

    I don't know whats wrong!

    Thanks,
    ~someonewhois

  19. #69
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, I can't make the ID table...

    It gives me an error!

  20. #70
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made it, with some hassle...

    1 more test!

  21. #71
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AWESOME

    So you have managed to connect to the database. Now looking at Kevins "Managing User with Sessions" tutorial, I notice this;

    Code:
    <?php // db.php
    
    $dbhost = "localhost"; // ( this was $server above )
    $dbuser = "user"; // ( this was $username above )
    $dbpass = "password"; // ( this was $password above )
    
    // $db was $database above
    
    function dbConnect($db="") {
    		 global $dbhost, $dbuser, $dbpass;
    		 $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
    		 		or die("The site database appears to be down.");
    				
    		 if ($db!="" and !@mysql_select_db($db))
    		 		 die("The site database is unavailable.");
    		 return $dbcnx;
    }?>
    What he's doing is making a function which you can re use, to select different databases.

    If you want a hack this will guarantee it works;

    Code:
    <?php // db.php
    
    $dbhost = "localhost"; // ( this was $server above )
    $dbuser = "user"; // ( this was $username above )
    $dbpass = "password"; // ( this was $password above )
    
    // $db was $database above
    
    function dbConnect($db="") {
                     $db = "databasename"; // <<< insert your database name here
    		 global $dbhost, $dbuser, $dbpass;
    		 $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
    		 		or die("The site database appears to be down.");
    				
    		 if ($db!="" and !@mysql_select_db($db))
    		 		 die("The site database is unavailable.");
    		 return $dbcnx;
    }?>
    This way it should be though is you have something like this in your pages;

    Code:
    include ( "db.php" );
    
    dbConnect ( "coasterthrills" ); <<< or whatever your database name is.
    Last edited by HarryF; Feb 21, 2002 at 18:56.

  22. #72
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That didn't work!

    I don't get any of this, why won't it work!?

  23. #73
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should I giveup?

    I'm wondering... it doesn't' seem to work...

  24. #74
    SitePoint Enthusiast
    Join Date
    Dec 2001
    Location
    Romania
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using:

    PHP Code:
    mysql_select_db($db$dbcnx); 
    instead of simply using:

    PHP Code:
    mysql_select_db($db); 
    wherever it appears in your scripts;

  25. #75
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I'll try that!


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
  •