SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Norway
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tutor by Kevin Yank - errors?

    Hi all,

    I'm learning to use php/mysql with the tutor at http://www.mysql.com written by Kevin Yank. My first impression? Nice work. Very good and simple explanation.

    Mysql is up and running and I created the jokes database as root.My first php pages work fine. I did a copy and past from the script on http://www.mysql.com/articles/ddws/23.html and called it in my Netscape browser. All I got was the line "Here are all the jokes in our database: "

    Looking at the source showed my the complete php code, including my username and password.

    Launching this page in Outlook resulted in following :

    Here are all the jokes in our database:

    Error performing query: " . mysql_error() . "

    "); exit(); } // Display the text of each joke in a paragraph while ( $row = mysql_fetch_array($result) ) { echo("
    " . $row["joketext"] . "

    "); } ?>

    Here aswell, the source showed me the complete php code.

    Any idea what this could be?

    Regards,

    Harry M. Aasterud
    Last edited by harry; Jun 17, 2001 at 22:52.

  2. #2
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi harry,

    have you checked this other topic?
    http://www.sitepointforums.com/showt...threadid=17194
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog · Twitter · Contact me
    Neon Javascript Framework · Jokes · Android stuff

  3. #3
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Norway
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    error in php/mysql tutor - part 4 ? (http://www.mysql.com/articles/ddws/23.html)

    Hi,

    Yes I did, but nothing is mentioned about part 4. Maybe it is no error at all, but did I make a beginners mistake...

    Please your comment.

    Regards,

    Harry M. Aasterud

  4. #4
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am assuming that you didn't just double clikc the file to open it in Netscape or do File->Open ? PHP pages need to be accessed through a web server for them to be executed.

    So you would need to open the file something like this:

    http://localhost/mypage.php

    then hopefully if your web server is setup correctly the page will execute and return what you were expecting it to return.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  5. #5
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no syntax error with the snippet of code you included in the post. I don't know what you mean exaclty by launching the page in Outlook (did you mean Explorer).

    However, there is an error occuring at the point where you are calling mysql_query() and querying the database to select all the jokes. Why php then drops out of parsing and returns the rest of the script to the browser is odd. Can you please post a few of the lines of code preceding that which you have given in your post?

    BTW, when you do post code wrap the code in [.php] [./php] or [.code] [./code] tags and it will display properly in the post. NB, remove the . (period) in the tags I wrote above to make them work.

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    It definitely sounds like you either don't have PHP set up properly on your Web server, or you are just opening the PHP file in your browser instead of loading it through your Web server... Can you shed any further light with these possibilities in mind, Harry?
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  7. #7
    SitePoint Member
    Join Date
    Jun 2001
    Location
    Norway
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    error in Kevin's php/mysql tutor - part 4

    Hi all,

    Thank you for all the feedback. Nice to see that good forums do exsist !

    The error was (as expected) on my end. As a newbee I thought that one could use regular *.html files with an embedded php script in the tags. Now I found that by renaming everithing to *.php, the excercises in part 4 DO WORK :-)

    I'll be back for more wisdom...

    Regards,

    Harry


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
  •