SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 40 of 40
  1. #26
    SitePoint Zealot Cute Tink's Avatar
    Join Date
    Apr 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm wondering if there is something in your setup that isn't allowing your script to see the same database that your myphpadmin is.

    However, try this script and see what happens. If it doesn't fail, then try your script again:

    PHP Code:
    $link mysqli_connect('localhost''root''');
    if (!
    $link) {
    echo 
    'Unable to connect to the database server.';
    exit();
    }

    $sql 'CREATE DATABASE  `ijdb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci';
    $query mysqli_query($link$sql) or die( mysqli_error$link ) ); 
    I tested this and it worked on my machine.

  2. #27
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will not allow me past the initial error check.

  3. #28
    SitePoint Zealot Cute Tink's Avatar
    Join Date
    Apr 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'll have to put your password in. If it is root then the first line would be:

    $link = mysqli_connect('localhost', 'root', 'root');

  4. #29
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What if I want to delete my MAMP and MySQL. I am starting to wonder if I have servers blocking each other. Otherwise I am at a loss on what to do

  5. #30
    SitePoint Zealot Cute Tink's Avatar
    Join Date
    Apr 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure on uninstalls in Macs. I work on a Windows system.

    Did that last method work at all?

  6. #31
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cute Tink View Post
    I'm not sure on uninstalls in Macs. I work on a Windows system.

    Did that last method work at all?
    Not at all...

  7. #32
    SitePoint Zealot Cute Tink's Avatar
    Join Date
    Apr 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm out of ideas. Perhaps someone who is more familiar with a MAMP system will think of something.

  8. #33
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thx for all your help though.. There has to be a simple explanation why it will not do what it is supposed to do. In the meantime, I am deleted MAMP and MySQL from the computer and will try and start over. My professor seems to think that by downloading MAMP and MySQL separately, that they are causing a conflict. I don't think he is correct, but I don't know either say myself.

  9. #34
    SitePoint Zealot Cute Tink's Avatar
    Join Date
    Apr 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, MAMP should stand for Mac Apache Mysql Php.

    Perhaps you did end up with two distinct databases. Phpmyadmin saw one and your scripts saw another.

  10. #35
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok.. well i uninstalled MAMP & MySQL (via term window) and then reinstalled MAMP, as before I can get my basic .php files to work, yet I am still unable to get this fricken server thingy to work. It is getting hung up on the 1st error agian..

  11. #36
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    'locate the file'... a Database is not a Directory. Not the same thing.

    If you cant get past $link = mysqli_connect('localhost', 'root', '');, then you've got a deeper problem.
    instead of echo 'Unable to connect to the database server.';, do echo mysqli_connect_error(); and tell us what comes out.

  12. #37
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    'locate the file'... a Database is not a Directory. Not the same thing.

    If you cant get past $link = mysqli_connect('localhost', 'root', '');, then you've got a deeper problem.
    instead of echo 'Unable to connect to the database server.';, do echo mysqli_connect_error(); and tell us what comes out.
    On the 1st Error.. I get No such file or directory

  13. #38
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think.. it might have been the way I was typing in the URL.. at first I was typing
    localhost/connect
    then I changed it to
    localhost:8888/connect
    and it seems to be working.. I do not understand that reasoning.. as I can call .php files that do not access the db w/o using the :8888

  14. #39
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    'No such file or directory' is a socket file issue. Your installation of PHP has got an incorrect socket file location.

  15. #40
    SitePoint Zealot
    Join Date
    Apr 2011
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    'No such file or directory' is a socket file issue. Your installation of PHP has got an incorrect socket file location.
    Why does it work now that I am telling it what port to use tho?


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
  •