View Single Post
ישן 27-09-07, 18:20   # 1
DanielS
הוסטסניון
 
מיני פרופיל
תאריך הצטרפות: Jan 2007
מיקום: ישראל
הודעות: 2,429

DanielS לא מחובר  

[PHP] הכנסת נתונים למסד

יש לי את השאילתא הבאה :
PHP קוד:
CREATE TABLE `articles` (
  `
idint(11NOT NULL auto_increment,
  `
ipvarchar(45NOT NULL,
  `
datevarchar(100NOT NULL,
  `
authortext NOT NULL,
  `
subjecttext NOT NULL,
  `
categorytext NOT NULL,
  `
descriptiontext NOT NULL,
  `
contenttext NOT NULL,
  
PRIMARY KEY  (`id`)
ENGINE=MyISAM  DEFAULT CHARSET=hebrew AUTO_INCREMENT=
לא נראה לי שהיא טובה בכלל.. כי דרך המערכת זה לא מכניס..
וזה החלק שאחראי על ההוספה :
PHP קוד:
if(isset($_POST['sumbit'])){
        
$ip $_SERVER['REMOTE_ADDR'] ;
        
$date date("j/n/Y") ;
        
$author $_POST['author'] ;
        
$subject $_POST['subject'] ;
        
$category $_POST['category'] ;
        
$description $_POST['description'] ;
        
$content $_POST['content'] ;
            if(
$author != "" $subject != "" $category != "" $description != "" $content != ""){
                    
$query "INSERT INTO `articles` (`ip`, `date`, `author`, `subject`, `category`, `description`, `content`) VALUES('$ip', '$date', '$author', '$subject', '$category', '$description', '$content')";
                    
$result mysql_query($query)
                    or die(
"Query failed: " mysql_error());    
                    echo 
"הכתבה נשלחה !" ;
            }else{
            echo 
"אנא מלא את כל השדות" ;
            }
    } 
תודה לעוזרים.
__________________
Daniel
Email : daniel [AT] smartwd [DOT] com

  Reply With Quote