Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6094741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:42:54+00:00 2026-05-23T12:42:54+00:00

Righ,t so on my website an admin puts the information into a form and

  • 0

Righ,t so on my website an admin puts the information into a form and then this is sent and becomes a news feed on the main page (Title, Body, Dateposted), but for some reason, (And I’ve checked against working code) this code is not working and I don’t know why, can someone help me?

<?php
        $post = mysql_query("INSERT INTO news(`title`,`body`,`date_posted`) VALUES('$title','$body','$date')");

        mysql_close($connect);

        header("Location: news.php");
    } 
    else 
    {
        echo "The body of the news post you entered is too short.";
    }
} 
?>

my datebase rows:

[id]
[title]
[body]
[date_posted]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:42:55+00:00Added an answer on May 23, 2026 at 12:42 pm

    This will only work if your ID field is designated as being AUTO-INCREMENTING

    http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

    EDIT

    The other technique you could adopt is to put your sql into a variable and when you hit problems you can echo it out onto the page (or into your error_log). It just means doing this:

    $sql = "INSERT INTO news(`title`,`body`,`date_posted`) VALUES('$title','$body','$date')";
    $post = mysql_query($sql);
    // now have an optional line of debug
    echo $sql;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To align my JFrame from righ-to-left, I use: setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); but this works only if
righ now i'm using Flex 4.1 libs, when compiling Flex puts all used libs
Below is my query. Is this righ? SQL> select case when value in (1000)
Morning, I'm just about ready to claw my own eyes out at this point.
Im trying to get two alpha-24 transparent .png files to crossfade into each other.
Beginner page building question: I've got a simple /div container defined via a CSS
Okay, in my head this is somewhat complicated and I hope I can explain
Hello pls could someone help... I've tried everything to get this to work in
SELECT * FROM left_table OUTER JOIN right_table on left_table.name = righ t_table.name; SELECT *
My problem is this exception: Caused by: <openjpa-2.1.1-r422266:1148538 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.