Results 1 to 2 of 2

Thread: Insert Problem using php...

  1. #1
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Question Insert Problem using php...

    I am having a problem with my user status system. When the user wants to updates their status it goes here. I am having a problem with this though. I want to store all the time/date information along with the message, and user id. I am not getting any errors but it doesn't insert the status into the table?

    PHP Code:
    <?php session_start(); ?>
    <!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>Untitled Document</title>
    </head>

    <body>
    <?php
    $email 
    $_SESSION['email'];
    $password $_SESSION['password'];
    $id $_SESSION['id'];
    $status $_POST['status'];
    $status strip_tags($status);
    $status addslashes($status);
    $date=getdate();
    $con mysql_connect("localhost","reader","correctpassword");
    if(!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }
    mysql_select_db("markmon_getaband_feeds"$con);

    mysql_query("INSERT INTO status (user_id, message, seconds, minutes, hours, mday, wday, mon, year, yday, weekday, month, 0) VALUES ('$id', '$status', '$date[seconds]', '$date[minutes]', '$date[hours]', '$date[mday]', '$date[wday]', '$date[mon]', '$date[year]', '$date[yday]', '$date[weekday]', '$date[month]', '$date[0]')");
    ?>
    <a href="../cp/index.php">Go back to your homepage</a>
    </body>
    </html>
    Thanks upfront
    Last edited by Rockonmetal; 10-04-2008 at 10:18 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    There is no such column `0`. You don't get any errors because you don't check for them: it's advisable to do mysql_query(...) or die(mysql_error());
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. The Following User Says Thank You to Twey For This Useful Post:

    Rockonmetal (10-04-2008)

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
  •