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
https://forums.phpfreaks.com/topic/4107-news-system-adding-2-instead-of-1/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.