SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    is very happy now :) Itay Neeman's Avatar
    Join Date
    Jun 2000
    Location
    Israel
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Guys,

    I am a fan of the kevin tutorial and currently am in part 4. I am having a problem. I copy and pasted kevin's html to contact the jokes database with php and put all the appropiate stuff and in write cases and everything and doublechecked and checked that the commands were working in the mysql prompt, and all it does is display the html part of the code, here is the code minus the login info:

    <HTML><HEAD><TITLE> Our List of Jokes </TITLE><HEAD><BODY><?php
    // Connect to the database server $dbcnx = @mysql_connect("host", "user", "pass"); if (!$dbcnx) { echo( "<P>Unable to connect to the " . "database server at this time.</P>" ); exit(); }
    // Select the jokes database if (! @mysql_select_db("jokes") ) { echo( "<P>Unable to locate the joke " . "database at this time.</P>" ); exit(); }
    ?><P> Here are all the jokes in our database: </P><BLOCKQUOTE>
    <? // Request the text of all the jokes $result = mysql_query("SELECT JokeText FROM Jokes"); if (!$result) { echo("<P>Error performing query: " . mysql_error() . "</P>"); }
    // Display the text of each joke in a paragraph while ( $row = mysql_fetch_array($result) ) { echo("<P>" . $row["JokeText"] . "</P>"); }
    ?>
    </BLOCKQUOTE></BODY></HTML>

    I really need help as I cant move on the tutorial and I want to see if I can write a pretty simple email collecting script but I need the MySQL part to work first. The reason I am so dumbfounded is because it doesnt return any errors.



    ------------------
    Best Regards,
    Itay Neeman

  2. #2
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    change your second <? to <?php as you have in the first.

    it may be accessing the mysql and the db but when you re-enter, your server is not set to handle the lack of the php.

    hope this works - ed

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It coul;d jsu tbe your display but it appears you have your connect statement on the same line as a comment so it is comenting out this connect statement.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On secoond thought it appears you have evrything commented out, so your @ error checking would not be recoginized, make sure you put everthing that isn't a comment on a new line ie.
    // Connect to the database server
    $dbcnx = @mysql_connect("host", "user", "pass");
    if (!$dbcnx) { echo( "<P>Unable to connect to the " . "database server at this time.</P>" );
    exit();
    }

  5. #5
    is very happy now :) Itay Neeman's Avatar
    Join Date
    Jun 2000
    Location
    Israel
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Freddy

    THANK YOU!!! THANK YOU!!! THANK YOU!!!

    It fixed the problem, it really commented them out, I am totally scr*wed up to not think of it myself.

    ------------------
    Best Regards,
    Itay Neeman

  6. #6
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi

    i love it. i never fail to learn.

  7. #7
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what i was saying before i interupted myself is that i never fail to learn - especially when i have made the mistake.

    thanks again to all.

    ed


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
  •