SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 67
  1. #26
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK i got it working on another comp still not my laptop any way the only way i can access the database is through mysql\mysqlserver 5.1\bin\mysql.exe command screen is this ok to use because it still not working from command promt in windows, also when i open the page in internet explorer all i get is white screen is this because of the way im entering through mysql and not comand promt here is the code;
    i am sorry for this but it is starting to get to me now cause ive done everything people have told me and from book and still having problems makes me wonder if i should knock it on the head but its somthing i realy want to learn;

    <?
    $link = mysqli_connect ('localhost','root','bailuk');
    if (!$link)
    {
    $output = 'UNABLE TO CONNECT TO DATABASE SERVER.';
    include 'output.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';
    ?>

    thankyou all for your patience and time bail

  2. #27
    SitePοint Troll disgracian's Avatar
    Join Date
    Aug 2006
    Location
    Samsara
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds very much to me like you're trying to go too fast, and expecting the book to tell you everything you need to know. That definitely won't work in the long run; it will barely work in the short term either.

    My advice on the process of learning programming (taken from my own experience):
    • Learn to read reference manuals and technical documentation. Goto the MySQl and PHP websites, bookmark them and revisit them frequently.
    • You seem to be trying to rip through chapters in this book as quickly as possible until you reach the end. Don't be in a hurry. Don't just move onto the next bit as soon as you've ticked some boxes. Play around a bit. Experiment. Take the scenic route, and give yourself time for the information to sink in.
    • Start small. I started learning Java and quickly got overwhelmed at the sheer size of it all. I revised my goals and played with simple file IO before I got to databases.
    • As soon as you start to get frustrated or angry, stop what you're doing. You won't be productive.

    Cheers,
    D.

  3. #28
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as any one got direct link for MYSQL this i cant find it

    windows essentials (x84) (AMD64/intel EM64T) 5.1.34


    i have found the msi installer one but in the book it says dont use that one ?


    THANKS BAIL

  4. #29
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok think ive sorted it on laptop now formatted the laptop wnet on stright away and seems ok.
    thanks everyone bail

  5. #30
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by disgracian View Post
    As soon as you start to get frustrated or angry, stop what you're doing. You won't be productive.
    I'll second that.

    Also, I find that if I let the knowledge go in at a rate my tiny brain can accept, rather than rushing it, I remember much more ~ for much longer. Pushing it in means I can be doing something very similar in just a couple of days time and I may not realise it until I have finished doing basically the same thing for second time. Sounds pathetic, I know, but thats the way I work and it is getting me to where I want to be.

    http://www.aesops-fables.org.uk/aeso...e-tortoise.htm

    bazz

  6. #31
    SitePοint Troll disgracian's Avatar
    Join Date
    Aug 2006
    Location
    Samsara
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by IBazz View Post
    Also, I find that if I let the knowledge go in at a rate my tiny brain can accept, rather than rushing it, I remember much more ~ for much longer. Pushing it in means I can be doing something very similar in just a couple of days time and I may not realise it until I have finished doing basically the same thing for second time. Sounds pathetic, I know, but thats the way I work and it is getting me to where I want to be.
    I think this is the case for most people. I can attest to constantly forgetting things learned in a hurry if I didn't use it for a week or more, and having to constantly search for the info over and over again.

    Sometimes you just have to force yourself to be diligent and play with things until they become second nature. And only then, move on to the next chapter/lesson/task.

    Cheers,
    D.

  7. #32
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i have sorted database added the jokes ect i have followed all instructions of how to link database mysql is running apache is running and all i am getting is blank white page when i connect to localhost/connect folder anyone tell me why! i should be getting database connection established or when i change my password for test reasons should have unable to connect to database server but im just gettin white page in ie and all other browsers?

    thanks

  8. #33
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    show us your code for connecting. You should have an error message to display when it, well, errors.

    bazz

  9. #34
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?
    $link = mysqli_connect ('localhost', 'root', 'bailuk');
    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';
    ?>

    thanks baz

  10. #35
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I'm wondering if you're getting a "blank screen" because the file was saved as UTF-8 with a BOM (signature).

    If so try openning it and saving it again making sure it's without a BOM

  11. #36
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks i havent got clue what you mean so i rewrote it all any way but nw im getting this error

    error:

    <? $link = mysqli_connect('localhost', 'root', 'bailuk'); if (!$link) { $output = 'UNABLE TO LOCATE THE JOKE DATABASE.'; include 'output.html.php'; exit(); } if (!mysqli_set_charset($link, 'utf8')) ( $output = 'UNABLE TO SET DATABASE CONNECTION SERVER,'; 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 ?>




    CODE:

    <?
    $link = mysqli_connect('localhost', 'root', 'bailuk');
    if (!$link)
    {
    $output = 'UNABLE TO LOCATE THE JOKE DATABASE.';
    include 'output.html.php';
    exit();
    }
    if (!mysqli_set_charset($link, 'utf8'))
    (
    $output = 'UNABLE TO SET DATABASE CONNECTION SERVER,';
    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
    ?>


    THANKS BAIL

  12. #37
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know much php but I found this, which you might like to use - even if only for testing purposes.

    Code PHP:
    // Make a MySQL Connection
    mysql_connect("localhost", "***********", "**********") or die(mysql_error());
    mysql_select_db("**************") or die(mysql_error());

    bazz

  13. #38
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i have got somthing come on me screen and im reading it as a port cannot connect but i have not set anyports when seting the software up if this is correct how do i set a port 3306 to allow it to connect in windows 7 ultimate or is it easyeir to just remove it all and start again the error is below and below that is my code thanks bail

    ERROR:


    Warning: mysqli_connect() [function.mysqli-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

    Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2



    MYCODE:

    <?php
    $link = mysqli_connect('localhost', 'root', 'bailuk');
    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 connection 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';


    ?>

  14. #39
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sounds like the MySQL server is not running on your computer. 3306 is the default port used by MySQL so you don't have to change that. Make sure it's still running, and if it is, try giving it a restart since it doesn't seem to be responding to your PHP script's attempt to connect.

  15. #40
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it says it running in task manager ??

    thanks bail

  16. #41
    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)
    Bail, do either of the following lines in your php.ini file

    extension=php_mysql.dll
    extension=php_mysqli.dll
    have a ; at the start of them:

    Have you tried restarting Apache?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  17. #42
    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 as the ; removed i have unistalled mysql and reinstalled it but i still gettin error in task manager it says it is runnin.if i use mysql command line
    it says your mysql connection id is 1

    doin me head in im nearly were i was in the book before it all broke haaa
    thanks bail

  18. #43
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any one tell me how check the ports on windows 7 incase this could be the problem?
    thanks

  19. #44
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i have found this fix for windows 7 but it still dont work any ideas anyone plzz im runing out


    The Fix

    Open up windows\system32\drivers\etc\hosts
    with a text editor and comment out the line that looks like:

    ::1 localhostPrefix it with a #, like so:

    #::1 localhostSave it and your PHP/MySQL connections will immediately begin working.
    You could also use 127.0.0.1 in your connection string instead of localhost,
    but I didn't want to change code in innumerable files.


    #::1 localhost

  20. #45
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by bail View Post
    as any one got direct link for MYSQL this i cant find it

    windows essentials (x84) (AMD64/intel EM64T) 5.1.34


    i have found the msi installer one but in the book it says dont use that one ?


    THANKS BAIL
    Just to get me up to date where things are at.

    You have installed everything on your PC and it all works fine?

    But you are still having trouble with your laptop?

    On your laptop, Apache and PHP seem to be OK, but you're having problems with MySQL?

    You know your laptop is 64bit and that's what you're trying to install?

    You can access MySQL from the command line, but PHP fails to connect?

    If you go to a PHP file with
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    it shows MySQL stuff in it?

  21. #46
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok Mittineague this is were i am now it seems be workin ok on both comps now, but the problem i have now is when i try to connect i get this error message

    Warning: mysqli_connect() [function.mysqli-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

    Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2

    i found this code on the net to fix the problem but it as not fixed it

    The Fix

    Open up windows\system32\drivers\etc\hosts
    with a text editor and comment out the line that looks like:

    ::1 localhostPrefix it with a #, like so:

    #::1 localhostSave it and your PHP/MySQL connections will immediately begin working.
    You could also use 127.0.0.1 in your connection string instead of localhost,
    but I didn't want to change code in innumerable files.


    #::1 localhost

    so any ideas
    thanks bail

  22. #47
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,154
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I'm not familiar with the "::" syntax, but AFAIK the "#" is just commenting out that line.

    But it does seem to be a Windows7 configuration bug.

    You could try changing the php code to
    PHP Code:
    mysql_connect("127.0.0.1""***********""**********") or die(mysql_error()); 
    or try changing the hosts file's line to
    Code:
    #::localhost
    127.0.0.1 localhost

  23. #48
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is drivin me stupid

    i have now got error ;

    Parse error: syntax error, unexpected $end in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 33

    but the problem is in deramweaver cs4 it is only showing 32 lines so why is the error on 33 when there is nothing there??

    here is the code from dwcs4

    <?php

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

    if ($link)

    {
    $output = 'UNABLE TO CONNECT TO DATABASE SERVER.';
    include 'output.html.php';
    exit();
    }

    if (!mysqli_set_charset($link, 'utf8'))

    {
    $output = 'UNABLE TO SET DATABASE CONNECTION ENCODING.';
    include 'output.html.php';
    exit();
    }

    if (!mysqli_select_db ($link, 'ijdb'))

    {
    $output = 'UNABLE TO LOCATETHE JOKE DATABASE.';
    include 'output.html.php';
    exit();

    $output = 'DATABASE CONNECTION ESTABLISHED.';
    include 'output.html.php';

    ?>

    sorry it does not show line numbers but there is only 32 lines

    thanks bail

  24. #49
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok ive fixed the problem above it was a missing curly bracket but im back to the old error got be someone who can point me in the right direction surley you gurus have come across this before here is the error code below again
    thanks (man with no hair left haa) bail


    ERROR CODE:

    Warning: mysqli_connect() [function.mysqli-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 3

    Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 3

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 3

  25. #50
    SitePoint Enthusiast bail's Avatar
    Join Date
    Feb 2010
    Location
    walsall westmidlands
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i getting there slowly now does any one have any ideas about this code

    Warning: mysqli_connect() [function.mysqli-connect]: Headers and client library minor version mismatch. Headers:50051 Library:50145 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 3

    this is my line 3 code

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

    the unable to connect to database sever is under the error code

    if i put a @ like this
    $link = @mysqli_connect(!'localhost', 'root', 'bailuk');

    the error goes away and just leaves the UNABLE TO CONNECT TO DATABASE SERVER.
    any ideas plz im getting there slowly
    thanks bail


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
  •