Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    4

    Unanswered: Help with my script

    Dear All,

    I am trying to learn mysql on my own and I was following an example. I have everything installed apache/php/mysql on win2k and working fine. I even managed to create a database jokes thru command prompt start>programs>accessories>, and I can display very well. However tryong to display in my browser using
    PHP Code:
    <html>
    <head>
    <title>Our List of Jokes </title>
    </head>
    <body>
    <?php

       
    // Connect to the database server
       
    $dbcnx = @mysql_connect('localhost''root''myne');
       if (!
    $dbcnx) {
       die( 
    '<p>Unable to connect to the ' .
              
    'database server at this time.</p>' );
       }

       
    // Select the jokes database
       
    if (! @mysql_select_bd('Jokes'$dbcnx) ) {
       die( 
    '<p>Unable to locate the joke ' .
              
    'database at this time.</p>' );
       }

    ?>

    <p> Here are all the jokes in our database: </p>
    <blockquote>
    <?php

       
    // Request the text of all the jokes
       
    $result = @mysql_querry('SELECT JokeText FROM Jokes');
       if (!
    $result) {
         die(
    '<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>
    won't work. What could be the problem.

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Help with my script

    Originally posted by Samia1667
    Dear All,

    I am trying to learn mysql on my own and I was following an example. I have everything installed apache/php/mysql on win2k and working fine. I even managed to create a database jokes thru command prompt start>programs>accessories>, and I can display very well. However tryong to display in my browser using
    PHP Code:
    <html>
    <head>
    <title>Our List of Jokes </title>
    </head>
    <body>
    <?php

       
    // Connect to the database server
       
    $dbcnx = @mysql_connect('localhost''root''myne');
       if (!
    $dbcnx) {
       die( 
    '<p>Unable to connect to the ' .
              
    'database server at this time.</p>' );
       }

       
    // Select the jokes database
       
    if (! @mysql_select_bd('Jokes'$dbcnx) ) {
       die( 
    '<p>Unable to locate the joke ' .
              
    'database at this time.</p>' );
       }

    ?>

    <p> Here are all the jokes in our database: </p>
    <blockquote>
    <?php

       
    // Request the text of all the jokes
       
    $result = @mysql_querry('SELECT JokeText FROM Jokes');
       if (!
    $result) {
         die(
    '<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>
    won't work. What could be the problem.
    Got you some error message?

  3. #3
    Join Date
    Nov 2003
    Posts
    4
    Actually I finally got it to work, there were typos in querry and not query and @mysql_select_bd and not @mysql_select_db.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •