SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Database driven websites chapter 4

    HELLO
    my name is bail im new to this forum i have got to chapter four of the book and im getting errors this is the code it says type;
    <?
    $link = mysqli_connect('localhost', 'root', 'bail');
    if (!$link)
    {
    $output = 'unable to connect to the database server.';
    include 'output.html.php';
    exit();
    }
    if (!mysqli_set_charset ($link, 'utf8'))
    {
    $output = 'unable to set database connecion encoding.';
    include 'output.html.php';
    exit();
    }
    if (!mysqli_select_db($link, 'ijdb'))
    {
    $output = 'unable to locate the joke database.';
    include 'output.html.php';
    exit();
    }
    $output = 'DATABASE CONNECTION ESTABLISHED.';
    include 'output.html.php';
    ?>

    but the problem i have is when i change the password like it say's in book to test the password is working im getting error like this


    Warning: mysqli_connect() [function.mysqli-connect]: (/838860800): in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2


    could anyone give me any advise i have tryed reinstall of all the software a few times and all that happens is the number in the error keeps changing
    thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change your link directive to

    PHP Code:
    $link mysqli_connect('localhost''root''bail') or die(mysql_error()); 
    and it will give you a much better description from the mysql server as to why things aint working.

    All pointers suggest that the password is not right. are you sure you have updated your server copy of the script with the new password?

  3. #3
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thankyou for your reply yes neil i think its sorted i put a @ infront of $link = @mysqli_connect('localhost', 'root', 'bail');it is working but this is not stated in the book at least i can got to the next chapter now thankyou i also have another question on the forum that no one as asnswered if you could answer that it would be big help thankyou for your help
    bail

  4. #4
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    All the @ symbol does is hide the visible message. The error would actually still occur.

    Take the @ symbol out and paste the error message you're getting.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  5. #5
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warning: mysqli_connect() [function.mysqli-connect]: (/838860800): in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

  6. #6
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have unistalled and reinstalled but all that changes is the number in the error

    Warning: mysqli_connect() [function.mysqli-connect]: (/838860800): in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Are you making use of the errata for the book? It's kind of important.
    http://www.sitepoint.com/books/phpmysql4/errata.php

    For example, the correction for page 12 might be of use for you.

    • p.12 Installing PHP

    Although this book provides download and installation instructions for PHP 5.2, the newly-released (at the time of this writing) PHP 5.3 includes some new download options that arenít covered in the book.

    There are four different versions of PHP 5.3. for Windows: VC6 Non Thread Safe, VC6 Thread Safe, VC9 Non Thread Safe, and VC9 Thread Safe. Talk about confusing!

    First of all, you definitely want a Thread Safe version of PHP. The Non Thread Safe versions are not suitable for use as a plugin for Apache.

    Secondly, assuming you will install (or have already installed) a version of the Apache HTTP Server from httpd.apache.org (see page 13), you will need the VC6 version of PHP.

    In short, to follow the instructions in this book, you need the VC6 Thread Safe version of PHP 5.3 for Windows.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks pmw i will try it and let you know
    thanks bail

  9. #9
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi pmw i have tryed all that and still same its doin me head in i got it workin on my main comp fine just laptop wont have it back to drwing board thanks bail

  10. #10
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,014
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    In your php.ini file there are two lines to do with MySQL:

    extension=php_mysql.dll
    extension=php_mysqli.dll
    Do either of them lines have a ; at the beginning of them?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  11. #11
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by bail View Post
    hi pmw i have tryed all that and still same its doin me head in i got it workin on my main comp fine just laptop wont have it back to drwing board thanks bail
    If you've tried what I posted in my previous message, then that's not enough.

    You need to go through the complete errata, and ensure that you have applied all of the fixes in there.

    --
    Paul Wilkins
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #12
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the extension=php_mysqli.dll does not have the ; i removed it like the book says i all so downloaded the one pmw said and installed it and now im getting this error mysqladmin: connect to server at 'localhost' failed
    error:'access denied for user 'root'@'localhost' (using password:yes)

    but i know 100&#37; the passwoed is correct
    i would like to say thanks to everyone who is trying to help me sort this problem out

    thankyou bail

  13. #13
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    What does the book say about setting up the password?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  14. #14
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysqladmin -u root -p password "newpassword " i have put new password were it says then it says press enter then enter again with out the password then mysqladmin -u root-p statuse then enter passwoed
    thanks bail

  15. #15
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    What do you see when you enter the following?

    Code:
    mysqladmin -u root -p status
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  16. #16
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i get enter password when i enter password i get the error and i have tryed it without the password and still get the error

    mysqladmin: connect to server @ localhost failed
    error access denied for user root@localhost (using password :no)

    if use passwored get (using password :yes)

  17. #17
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    That's good to know, because the password has not yet been changed, as the password is stored in the database.

    Don't bother with the password until you get the server up and going. You won't be able to save the password until the database is working.

    I presume that you get a similar variation of the error with this command?

    Code:
    mysqladmin -u root -p version
    Have you confirmed that the mysql service is active?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  18. #18
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do i find out if its running it is in the task manager msqld.exe like it says to check in the book is there another way


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
  •