SitePoint Sponsor

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 25 of 67
  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 page chapter4

    hi everyone i am new to db websites and theses forums i have brought the book by kevin yank database driven websites and i have got to chapter 4 and followed it word by word but i am haveing a problem with the database error:

    Warning: mysqli_connect() [function.mysqli-connect]: (/838860800):


    what is happening it should say

    unable to connect to the database server.

    this is when i changed the password to test see if it is working when i use the correct password it says connected to database but when it says chage password to see if it gives the unable to connect to the database server. i get this error above i have unistalled it and reinstalled the software but all that happens is it changes the number in the error this is the code from the book and i cant work this error out can anyone help me asap thanks.


    the code:

    <?
    $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';
    ?>


    and the output code is :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <"http://www.w3.org/TR/xhtml1/DTD/xhtm
    -transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <? echo $output; ?>
    </body>
    </html>

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    when i changed the password to test see if it is working when i use the correct password it says connected to database but when it says chage password to see if it gives the unable to connect to the database server
    This sounds like what's supposed to happen.

    When you use the correct password, you connect to the database.

    When you use an incorrect password, you cannot connect to the database.

    So why is this wrong?

  3. #3
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    instead of saying unable to connect to the database server.

    it is giving this error: Warning: mysqli_connect() [function.mysqli-connect]: (/838860800):

    but it should say unable to connect to the database server.

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you want to suppress error messages from a function, you can add a @ before the function name

    PHP Code:
    $link = @mysqli_connect('localhost''root''bail'); 
    On a production website, you'd change your PHP configuration to not display errors but instead log them, so you don't need (or want) to suppress them.

  5. #5
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you dan that as worked but it not in this book and i am very new to databases and php at least i can move on through the chapter now thankyou
    bail

  6. #6
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thankyou everyone who as tred to help me but i think it time to give up ive tryed everything you have said and still no good time throw book in the bin would any one know of a good book that would help me learn php and msql
    thanks bail
    ps. if you now any good books i can buy please would you give me the name and author

  7. #7
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The books are about programming, they're not going to help you with the basic issue of setting up the servers you're having. Buying a different book won't help because they're just going to repeat the same information that comes from the vendors of the software (Apache, MySQL, PHP) you're installing.

    Maybe you should sidestep it entirely and just get some cheap web hosting and play there while you go through the book.

  8. #8
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    who u think u talkin to dan the book spoused to set it up its load rubbish and waste money so mind your own business if i wanted cheap webhosting iwould have proberly come to you mr market guru and been ripped off even more people like you make me sick think you know everythin, so mind it

  9. #9
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No reason to get angry, you were just thanking me a few minutes ago, I was trying to help. I don't want to see you get even more frustrated by buying more books that can't help you with this problem. I don't work for SitePoint and I don't get anything out of you buying anyone's book or hosting.

    You might look through the book's eratta as there are some notes on changes since the book was printed.

    If all else fails, you can try uninstalling everything you installed, and downloading XAMPP. It is a program that installs Apache, MySQL and PHP for you all at once.
    Last edited by Dan Grossman; Mar 24, 2010 at 11:57.

  10. #10
    The Mind's I ® silver trophy Dark Tranquility's Avatar
    Join Date
    Sep 2003
    Location
    KSA - UAE
    Posts
    9,457
    Mentioned
    8 Post(s)
    Tagged
    1 Thread(s)
    Bail,
    I am sorry you're having trouble with this book but I can tell you it is a very good book otherwise it is not logical to have it printed in 4 editions nor to see that it is out of stock now.

    Moreover Dan is one of the most valuable and knowledgeable members here! And he's a very nice person and tried to help you with your issue and he's really good in what he does and believe he's not solely a Marketing/E-commerce guru I've been around here for long years now and Dan helped me as he did with hundreds of members so please don't be rude while he was trying to help you! I understand your frustration but believe me things will definitely be smoother if you calm down a bit and accept to be helped.

    You will probably need to search for complementary info on the net (tutorials, forums, articles) in order to completely profit from the book.
    And as Dan suggested you can download XAMPP or EasyPHP to have a fully functional PHP/MySQL developing environment.

    So really there's no reason to get upset and use this aggressive tone.
    Good luck

  11. #11
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,252
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I hear you loud and clear bail.

    I tried the Ruby on Rails book. It gives instructions for how to use InstantRails. I couldn't get it working and ending up installing the components individually.

    I tried the Build with PHP + MySQL book. It gives instructions for how to install the components individually. I couldn't get things working and ended up using XAMPP (I tried WAMP and EasyPHP too but without luck).

    I'm now trying Build with ASP.NET which gives instructions for how to install Visual Web Developer. My old OS won't support it so I installed Visual Studio instead. My OS won't support IIS so I intalled PWS.

    So why do these books give installation instructions that don't work?!?

    My guess is that they do work for a majority of people. just that I never seem to be in that majority.

    Over-simplified, but the key things to consider are:
    your Operating System (it limits what will be supported)
    your server
    your language engine
    your database engine

    If you can't get those installed and working happily together by following a book's instructions, don't keep banging your head into the same wall. Try alternative approaches.

    Although you may run into some problems by using a different platform than what the book is using, I think as long as you're close things should be OK. Because this book is primarily concerned with PHP and MySQL as long as you have the same versions (or newer) of PHP and MySQL on your localhost I don't think youll have any problems. Even if you have to use older versions, you shouldn't be completely crippled to the point where you can't learn most of it.

  12. #12
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have sorted it but i am gettin this error now
    Parse error: syntax error, unexpected ')' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
    everthing is in the database exactly how it says in book the code is exactly same as book here is the code
    <?
    $link = mysqli_connect ('localhost','root','bailuk',);
    if (!$link)
    {
    $output = 'UNABLE TO CONNECT TO DATABASE SERVER.';
    include 'outp.html.php';
    exit();
    }
    if (!mysqli_set_charset($link, 'utf8'))
    {
    $output = 'UNABLE TO SET DATABASE CONNECTION ENCODING.';
    include 'output.htmp.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';
    ?>
    any ideas


    and dan i read it as you was sayin i was thick
    qoute;
    Maybe you should sidestep it entirely and just get some cheap web hosting and play there while you go through the book.
    i already have host im just learning php mysql
    any way forget it i was in mood and then read that like so :
    thanks to everyone who as tryed to help and i appoligse to anyone who taken it the wrong way
    thanks bail

  13. #13
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No problem. I wasn't trying to say that. The error is because on this line:

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

    You have an extra comma after your password

  14. #14
    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 when i reamove it i am still getting the same error

    this is the error:
    Fatal error: Call to undefined function mysqli_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

    this is the code:
    $link = mysqli_connect ('localhost','root','bailuk');

    i have also tryed the @ like you said before but all i get is a blank white page

    thanks again bail

  15. #15
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,072
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    In your php.ini file there should be a line:

    extension=php_mysqli.dll
    does that line have a ; at the start of it, if it does, remove the ; then restart the server.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  16. #16
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea it does have that kind of code and no it as not got the ; at the beginning

    there is also the extension=php_mysql.dll which i have removed the : and then replaced it and it still
    makes no diffrence still get the error

    thanks bail

  17. #17
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,252
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I don't know what you finally ended up installing, but you may have more than one php.ini file. eg. in my XAMPP folder I have one in
    .../apache/bin/
    and another in
    .../php/

  18. #18
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thankyou for your help i only have one php,ini file in php so it looks like remove all and reinstall again haa keep tryin dont give up ill get there one day back in bit gonna reinstall everything
    thankss bail

  19. #19
    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 all the programs and removed the mysql files and apaches folder out of
    program files and restared my comp when i reinstall the programs everthing is still there from the last install were eles does it put the files so i can do a complete install
    thanks bail
    oh removed from control panel

  20. #20
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,252
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    If you uninstalled everything and removed the folders, I don't see how the old ones would still be there. ??? Anyway, Do you have one of the following operating systems and are using the correct files for Apache, MySQL, and PHP ?

    Windows XP, Windows Vista, Windows 7
    Code:
    MySQL
    	Windows Essentials (AMD64/Intel EMm64T)
    	Windows Essentials (x86)
    PHP
    	5.2.x zip Windows Binaries
    Apache
    	Win32 Binary without crypto (no mod_ssl) 2.2.11-win3-x86-no ssl.msi
    Mac OS X 10.5 (Leopard)
    Code:
    MySQL
    	Mac OS X 10.5 (x86_64)
    	Mac OS X 10.5 (x86)
    PHP 5	- built in
    Apache 2.2	- built in
    Ubuntu 8.10 (Linux)
    also Fedora, Debian, openSUSE, Gentoo

    Code:
    MySQL	- non RPM
    	Linux (AMD64/Intel EM64T)
    	Linux (x86)
    Apache
    	Unix Source: httpd-2.2.11.tar.gz
    PHP
    	php-#.#.##.tar.(gz|bz2)
    And if you're trying to install PHP 5.3 you're using the correct one as described in the books errata ? http://www.sitepoint.com/books/phpmysql4/errata.php
    # 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.

  21. #21
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your reply i am using windows 7

    Windows Essentials (AMD64/Intel EMm64T)

    VC6 Thread Safe,
    i got it working fine on my main comp it just laptop

    the set up out the book works ok with my main execpt error message
    Parse error: syntax error, unexpected ')' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
    when try to view in ie but the database part works fine
    thanks bail

  22. #22
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,252
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    No problem. I wasn't trying to say that. The error is because on this line:

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

    You have an extra comma after your password
    If you have an extra comma, PHP expects another argument. Since there isn't one, the closing parenthesis is unexpected.

  23. #23
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have installed the v6 thread safe version like you say and the one out the book but im still getting these error:

    c:\uswers\bail_main>mysqladmin -u root status
    mysqladmin: connect to server at'localhost' failed
    error: 'access denied for user 'root'@localhost' <using password: no>'



    c:\uswers\bail_main>mysqladmin -u root status
    mysqladmin: connect to server at'localhost' failed
    error: 'access denied for user 'root'@localhost' <using password: yes>'

    php is showing in the apache box and when i go to localhost through the browser its all working, it just when i go to command promt and type;

    mysqladmin -u root status

    i get the errors so is it just down to php?

    ive unistalled everything and reinstalled them but im lost
    thanks bail

  24. #24
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP is not involved in running mysqladmin

    You need to use your password (-p) to connect to the mysql server from any software

  25. #25
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok in the book it says
    mysqladmin -u root status

    when you hit enter you should see a line or two of basic statistics about your mysql
    sever like this:
    uptime:102261 threads:1 questions:1 slow queries:0
    open:15 flush table:1 0pen tables:0
    queries per second avg: 0.0

    but im getting thoses errors and if i use
    mysqladmin -u root -p
    i just get loads of text come on the screen just few lines of what comes on but there is loads:
    verbos false
    vertical false
    connect_timeout 43200
    shutdown_timeout 3600

    thanks bail
    id pull my hair out if i had some so ill just keep banging me head upwall haa


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
  •