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 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    Okay, PowWeb is my web host. Included in the package are up to 5 mySQL databases. Only, when I try to create a database, nothing happens.

    Background:
    I know very little beyond the logic of php.

    I've read a few tutorials, step one at least, and if I am unable to set up a database, obviously nothing will materialize. I figure I have a server, and access to the mySQL through my server, and what I really need is RAM, so I would rather run it remotely than download all the stuff to my hard drive. But, if you recommend I do that, I'll trust you, since I have no idea what I am doing right now.

    I'm at the point where I have read everything about 10 times, and I cannot go any further without actually doing it, and my original plan on how to go about "doing it" is not working.
    Shani

    I have an eye for detail like you'd never believe.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    I checked PowWeb out and yes it says you can have upto 5 mysql databases, it also says your deal comes with phpMyAdmin installed.

    phpMyAdmin lets you run queries on your database instead of using PHP to do them, or to check expected results, and so on.

    If you think you have done what is needed to create a database via your control panel, then find the phpMyAdmin image/text link and go in there.

    On the left (for me anyway) will be a drop down box of all your databases, most likely only 1 option for you.

    Select that option and the page will reload, now you should be able to create tables, all through a fairly easy to use interface.

    Once you have entered the column names, sizes, attributes etc, and created the table, if it was a success you will be given the mysql code that creates the table, it is useful for yourself to save that generated code, for your learning.

    Any other questions, come back,

    Good luck.

  4. #3
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    Okay, so I was able to create the database (problem there was a missing semicolon), then I went through the phpAdmin stuff as described above. I was able to do that okay enough (I think) using the same info from the tutorial.

    So, any idea where the database is stored? How do I connect to it?
    I'm using the code
    PHP Code:
     mysql_connect() or die ("Problem connecting to DataBase"); 
    and obviously, it is dying, so how do I make it live?

    Again, not sure where the database is on the directory, but this whole learning experiment site is in the php folder as such:
    htdocs/php/
    Shani

    I have an eye for detail like you'd never believe.

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    For debugging info, I use this script.

    PHP Code:
    <?php

    // connect
    // change the values to match your database

        
    $location "localhost"// change $username, $password and $database to match your details
        
    $username "prefix_username";
        
    $password "";
        
    $database "prefix_database";
        
    $conn mysql_connect("$location","$username","$password");

         if (
    $conn
            { 
                
    //echo "Could connect MySQL<br />\n";
            
    }
         else
            {
                
    //echo "error connecting.<br />\n";
            
    }
        
    mysql_select_db($database,$conn) or die ("Could not open database");

    ?>
    And if I am unsure if I am connecting, I un-comment the echo lines.

    If you un-comment the echo lines and connect Okay, you should now be able to run sql queries.

  6. #5
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    I am not sure how to apply this to my script. For one thing, I know that I am not connecting. Also, I do not have it set up locally, only on the remote server, would that matter? (Both the database and the php pages are on the remote server.) And where it has "prefix_username" would that become "prefix_dcscene" or just "dcscene"?
    Shani

    I have an eye for detail like you'd never believe.

  7. #6
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Localhost is fine for running it off a server.

    If your username is dcscene then the prefix to your mysql database and my sql user will be dcscene_.

    For me on one of my sites, my prefix is exlluhz_ so my connection code looks like
    PHP Code:
    <?php
        $location 
    "localhost";
        
    $username "exlluhz_bfsog";
        
    $password "";
        
    $database "exlluhz_site";
        
    $conn mysql_connect("$location","$username","$password");
    ?>

  8. #7
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    :-/ now I am confused. If I do not know what my prefix is, then it's probably dcscene? so then would it be "dcscene_dcscene"?
    Shani

    I have an eye for detail like you'd never believe.

  9. #8
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    Hi, because you are on a multi user shared server all you’re (up to 5) databases must be unique to the system; eg:

    dcscene_forums
    dcscene_blog

    there are most likely 1000's of other people with their usernames making databases and the prefix means that they can also have a database called forums or blog... the prefix makes them unique within mysql just like your username is unique within the system.

    If you made a database called dcscene then the prefix may make it dcscene_dcscene.

    If you create a test.php file and throw that script from bfsog in it (un-commenting the lines) you should get an idea on what is going wrong.

    There is no harm in trying connection values, the script will tell you what you have done wrong be it wrong username/password or database name.

    One way for you to see your database(s) (the name for your database) is to go into phpmyadmin and the dropdown list will contain your databases... use that exact full name that appears in the list and the password that you setup for it (which MAY be your hosting password)

    Once you have put those variables into the script post back your results.

  10. #9
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    I'm still confused about what a prefix is and how I'm supposed to use it. If I'm understanding toadeny: the host, would automatically make my user name the prefix. Not sure?

    Assuming that is the case... I put this test script in, changed the variables and uncommented the echoes, and ended up still not connected. :-/ The result

    error connecting.
    Could not open database
    There is no information on what is wrong.
    Shani

    I have an eye for detail like you'd never believe.

  11. #10
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    ok, so from what you have posted it seems you can connect (username/password) are correct, but the database either doesnt exist, or you dont have permissions to connect to it.

    try this script (adapted from bfsog (replace the usual stuff)
    if your host allows you to, this should list the database(s) you have access to...
    this should help determine what to put in the database value...

    Code:
    <?php
    
    // connect
    // change the values to match your database
    
        $location = "localhost"; // change $username, $password and $database to match your details
        $username = "prefix_username";
        $password = "";
        $database = "prefix_database";
        $conn = mysql_connect("$location","$username","$password");
    
         if ($conn)
            {
                //echo "Could connect MySQL<br />\n";
            }
         else
            {
                //echo "error connecting.<br />\n";
            }
    //    mysql_select_db($database,$conn) or die ("Could not open database");
    
    //code to see what databases you have access to
    
    $result = mysql_query('SHOW DATABASES');
    
    print_R( mysql_fetch_assoc($result) );
    
    ?>

    Hope that helps you determine your database name!


Page 1 of 2 1 2 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
  •  

Search tags for this page

mysql password requirements powweb

Click on a term to search for related topics.
All times are GMT -6. The time now is 03:02 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com