Activity Stream
48,167 MEMBERS
61488 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 10 of 14

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member
    When I did mysql_real_escape_string it gave me errors.
    Speakup Reviewed by Speakup on . [PHP] Guestbook I was a little bored so I coded a PHP guest book for my site. I felt like sharing it with KWWH as well! index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Guest Book</title> </head> Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Developer
    Website's:
    wrzc.org
    Quote Originally Posted by Speakup View Post
    When I did mysql_real_escape_string it gave me errors.
    Put this above the part I edited earlier. You have to be connected to the database for it to check the inputs to make sure their clean.
    PHP Code: 
    mysql_connect("localhost","username","password") or die(mysql_error());
    mysql_select_db("database") or die(mysql_error()); 
    So it will be like this:
    PHP Code: 
    mysql_connect("localhost","username","password") or die(mysql_error());
    mysql_select_db("database") or die(mysql_error());

    $name mysql_real_escape_string($_POST['name']);
    $email mysql_real_escape_string($_POST['email']);
    $comment mysql_real_escape_string($_POST['comment']); 
    $time now();
    $add mysql_query("INSERT INTO guestbook (name, email, comment, date) VALUES ('$name','$email','$comment', '$time')"); 
    Edit: Gav0 beat me this time
    Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic

    Huge list of Warez Sites and free Multiposter Templates

  4.     
    #3
    Member
    Quote Originally Posted by Mr Happy View Post
    Put this above the part I edited earlier. You have to be connected to the database for it to check the inputs to make sure their clean.
    PHP Code: 
    mysql_connect("localhost","username","password") or die(mysql_error());
    mysql_select_db("database") or die(mysql_error()); 
    So it will be like this:
    PHP Code: 
    mysql_connect("localhost","username","password") or die(mysql_error());
    mysql_select_db("database") or die(mysql_error());

    $name mysql_real_escape_string($_POST['name']);
    $email mysql_real_escape_string($_POST['email']);
    $comment mysql_real_escape_string($_POST['comment']); 
    $time now();
    $add mysql_query("INSERT INTO guestbook (name, email, comment, date) VALUES ('$name','$email','$comment', '$time')"); 
    Edit: Gav0 beat me this time
    Call to undefined function now()
    that is to the

    $time = now();

  5.     
    #4
    Respected Developer
    Website's:
    wrzc.org
    Quote Originally Posted by Speakup View Post
    Call to undefined function now()
    that is to the

    $time = now();
    Shit sorry it's late here and I'm not thinking straight. Use time() instead. You can also use date. Have a look at http://www.php.net/manual/en/function.date.php to see what type of day you want and how you want it displayed.

    eg 1st July 2010, 1-7-2010, 7-1-10, etc etc.

    I've moved this to the coding area as it's more of a coding topic than a Tutorial.
    Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic

    Huge list of Warez Sites and free Multiposter Templates

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating a Guestbook in RVSiteBuilder
    By Areon in forum Server Management
    Replies: 0
    Last Post: 3rd Mar 2014, 03:12 PM

Tags for this Thread

BE SOCIAL