Results 1 to 2 of 2

Thread: PHP-MySQL problems

  1. #1
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    36

    Default PHP-MySQL problems

    Hi,

    I would like to create my own forum and I'm using this code to insert the nickname, message and date of posting into my database.
    mysql_query('INSERT INTO "Database" [("IndexCol", "NicknameCol", "MessageCol"), "DateCol"] VALUES ("1", {$_POST["Nickname"]}, {$_POST["Message"]}, {date()})');

    Someone explained me this but it doesn't work. I have no idea on how to fix this. Is there anyone who could help me?
    (names were changed)

    Thanks in advance

  2. #2
    Join Date
    Mar 2005
    Location
    Belgium
    Posts
    263

    Default

    Hi there.
    I saw your site is in French.
    I can speek French too.
    Go to http://www.phpcs.com/

    Try this:

    $rq="INSERT INTO Database (IndexCol,NicknameCol,MessageCol,DateCol) VALUES ('1',{$_POST['Nickname']},{$_POST['Message']},date())";

    $result=mysql_query($rq) or die ("Error while inserting");

    Why do you insert always the value "1" for IndexCol?

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
  •