Jump to content

news system adding 2 instead of 1


Shadow Hatake

Recommended Posts

Okay so I made this news system and it worked fine for a while, but now it's acting up and adding a blank entry to the databse when I post a piece of news.

Code from confirm.php:
[code]    } elseif( $_GET['p'] == 'news' ) {
        $stat_chk_query = 'SELECT status FROM users WHERE name = "'.$_SESSION['valid_user'].'"';
        $result = mysql_query( $stat_chk_query );
        $row = @mysql_fetch_array( $result, MYSQL_ASSOC );
        
        if( $row['status'] == 2 ) {
            $news_add_query = 'INSERT INTO news( title, news, date, user )';
            $news_add_query .= 'VALUES( "'.$news_title.'", "'.$news_content.'", NOW(), "'.$_SESSION['valid_user'].'" )';
            $result = mysql_query( $news_add_query );
            
            if( $result ) {
                content_box( $news_pos_title, $news_pos_content );
            } else {
                content_box( $news_neg_title, $news_neg_content);
            }
        } else {
            content_box( $news_err_title, $news_err_msg);
        }[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.