SitePoint Sponsor

User Tag List

Page 8 of 8 FirstFirst ... 45678
Results 176 to 184 of 184
  1. #176
    SitePoint Member Speedy's Avatar
    Join Date
    Mar 2002
    Location
    Slovenia, Kranj
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Kevin!

    I am a user from Eastern Europe. I really like your articles and I don't doubt that the book is also great. But I have a problem. Where or. how can I buy your book (I am from Slovenia) if I don't have a credit card?

    Thank you,
    Sebastian

  2. #177
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    We also accept orders by PayPal.com (who let you transfer money directly from your bank account), and if all else fails you can send a check or money order for US$50 to our Melbourne offices:

    SitePoint Pty Ltd
    Book Orders
    Suite 6, 50 Regent St
    Richmond VIC 3121
    Australia

    Include your payment, your shipping address, and your email address so we can notify you that your order has shipped.

    The added expense ($50 instead of $41.90) is to cover the bank fees on our end associated with cashing foreign checks and money orders.
    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

  3. #178
    SitePoint Enthusiast
    Join Date
    Sep 2001
    Location
    \|/
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi Kevin -

    That code worked in terms of keeping the page from resubmitting over and over, but it screwed up the

    echo("<p> Your joke has been added.</p>");
    } else {
    echo("<p>Error adding submitted joke: ". mysql_error() ." </p>");

    The text "Your joke has been added" doesn't appear at the top now, but it does get added to the dbase. Interestingly enough, when the delete code is written and activated, it does say "Joke deleted," so that's echoing properly.

    I am assuming it has something to do with the header:

    // Redirect to prevent re-submit on reload
    header("Location: $PHP_SELF"); // **** NEW LINE ****

    b/c that header code doesn't appear in the "delete" block of code? Any ideas why?
    PeopleCards: The Official People Trading Card
    http://www.peoplecards.net

  4. #179
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ah yes, you need to make a few more changes if you want the message to display properly. Because you redirect the browser to reload the page after you insert the joke, you need to pass a variable with that redirect that indicates the insertion was successful.

    Notice the changes in the updated code below:
    PHP Code:
    <?php
      
    // Connect to the database server
      
    $dbcnx = @mysql_connect("localhost""root""mypasswd");
      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();
      }

      
    // If a joke has been submitted,
      // add it to the database.
      
    if ($submitjoke == "SUBMIT") {
        
    $sql "INSERT INTO Jokes SET
                JokeText='
    $joketext',
                JokeDate=CURDATE()"
    ;
        if (!@
    mysql_query($sql)) {
          echo(
    "<p>Error adding submitted joke: " .
               
    mysql_error() . "</p>");
          exit();
        }
        
    // Redirect to prevent re-submit on reload
        
    header("Location: $PHP_SELF?insertok=1");
      }
    ?>
    <html>
    <head>
    <title> The Internet Joke Database </title>
    </head>
    <body>
    <?php
      
    if (isset($addjoke)): // If the user wants to add a joke
    ?>

    <form action="<?=$PHP_SELF?>" method="post">
    <p>Type your joke here:<br />
    <textarea name="joketext" rows="10" cols="40" wrap></textarea><br />
    <input type="submit" name="submitjoke" value="SUBMIT" /></p>
    </form>

    <?php
      
    else: // Default page display

        
    if (isset($insertok)) {
          echo(
    "<p>Your joke was added to the database!</p>");
        }

        echo(
    "<p> Here are all the jokes in our database: </p>");
      
        
    // Request the text of all the jokes
        
    $result = @mysql_query("SELECT JokeText FROM Jokes");
        if (!
    $result) {
          echo(
    "<p>Error performing query: " mysql_error() . "</p>");
          exit();
        }
      
        
    // Display the text of each joke in a paragraph
        
    while ( $row mysql_fetch_array($result) ) {
          echo(
    "<p>" $row["JokeText"] . "</p>");
        }
      
        
    // When clicked, this link will load this page
        // with the joke submission form displayed.
        
    echo("<p><a href='$PHP_SELF?addjoke=1'>Add a Joke!</a></p>");
      
      endif;
      
    ?>
    </body>
    </html>
    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

  5. #180
    SitePoint Addict smcausland's Avatar
    Join Date
    Jul 1999
    Location
    Victoria, BC, Canada
    Posts
    233
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am working with challenge.php and have it figured out but am trying to move a little bit farther with it and am stuck.

    What if rather than just saying the joke has been deleted I want to say which joke was deleted as well?

    Thanks
    www.treelinestudio.com
    Online Showcase of works by Canadian Watercolour artist David Brougham.

  6. #181
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    In that case, the segment of code responsible for handling deletion would have to first perform a SELECT query to obtain the joke text for display.
    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. #182
    SitePoint Member
    Join Date
    Mar 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: "Build a Web-based file repository or photo gallery"

    I am looking for distribution and marketing channels for a line of adult screen savers. Can you help?

    Originally posted by wetfires
    I'm going to create a wallpaper/background site. I wonder if this topic covered in your book is worth the US$34.95. I'm sure your book is great, but creating an advanced wallpaper site is all I need to do.

    Your book looks fantastic, but I've already skim read your Online PHP/MySQL (to look at it in detail soon), I'm wondering is your book is worth it for the one task (since I'm not going to be using PHP/MySQL for anything else?

    Thanks alot!

  8. #183
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wondering...

    If I buy a copy of the book today, will it be shipped with all the confirmed typos fixed? Or do you send a pre printed copy?
    Mike
    It's not who I am underneath, but what I do that defines me.

  9. #184
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Copies are printed in advance in batches of 200. We have not yet found it neccessary to make changes to the printed version of the book, as the issues listed on the errata page are all relatively minor.
    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


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
  •