הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   [PHP] הכנסת נתונים למסד (https://hosts.co.il/forums/showthread.php?t=54258)

DanielS 27-09-07 18:20

[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 
"אנא מלא את כל השדות" ;
            }
    } 

תודה לעוזרים.

Cream 27-09-07 18:41

עשית התחברות למסד בכלל שאתה מנסה להכניס אליו נתונים?

DanielS 27-09-07 18:44

כן. אמרתי שאין שגיאות בעיניין..
רק עכשיו שמתי לב שאני מטומטם אני חצי שעה מנסה לפתור והבעיה הייתה בתנאי.


כל הזמנים הם GMT +2. הזמן כעת הוא 08:33.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ