Niets in database gooien?

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Danny@dw-designs.n

[email protected]

12/03/2009 17:16:00
Quote Anchor link
Hallo,

Ik heb een script waarbij input-velden zijn.
Als ik op submit druk hoort hij de waardes die ik meegeef in m'n database te gooien, echter doet hij dit niet;

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
if (isset($_GET["id"])){
$news_id = $_GET["id"];
$result = mysql_query("SELECT * FROM news WHERE id = $news_id ");
while (list($id, $uDatee, $subject, $creator, $time, $date, $content, $reactions) =
mysql_fetch_row($result)){
$uContent = $content;
$uContent = stripslashes($uContent);
$textbox = '
<form method="post" name="reaction">
<table>
  <tr>
    <td>Name:</td>
    <td><input name="your_name" type="text" value="Your name!" class="default_input_field" /></td>
  </tr>
  <tr>
      <td>Email:</td>
    <td><input name="your_email" type="text" value="Your E-Mail!" class="default_input_field" /></td>
  </tr>
  <tr>
      <td valign="top">Reaction:</td>
    <td><textarea name="your_reaction" rows="8" cols="64" class="default_input_field">Your reaction!</textarea></td>
  </tr>
  <tr>
      <td valign="top"><input type="submit" name="submit" value="Submit" class="default_input_button"></td>
    <td></td>
  </tr>
</table>
</form>'
;
?>

<table border="0" cellspacing="5">
      <tr>
          <td width="400" valign="top" class="content">
    <strong>NEWS: <?php echo "//" . $subject; ?></strong>
    <hr class="content_hr" />
<table>
  <tr>
    <td class="user_text"><strong>Date</strong>:</td>
    <td class="user_text" align="left"><?php echo $date; ?></td>
  </tr>
  <tr>
    <td class="user_text"><strong>Creator:</strong></td>
    <td class="user_text" align="left"><?php echo $creator ?></td>
  </tr>
  <tr>
    <td align="left" class="user_text" valign="top"><strong>Bericht</strong>:</td>
    <td class="user_text" align="left"><textarea disabled="disabled" rows="15" cols="64" class="default_input_field"><?php echo $uContent; }}?></textarea></td>
  </tr>
  <tr>
    <td colspan="2">REACTIONS:<br /><hr class="content_hr" /></td>
  </tr>
  <tr>
      <td colspan="2">
<?php
$result_count
= mysql_query("SELECT * FROM news_reactions WHERE id_news = $news_id ");
while (list($id, $id_news, $subject, $user, $time, $date, $content) =
mysql_fetch_row($result_count)){
    if($content != NULL) {
        echo '
        <table>
              <tr>
                <td>Name:</td>
                <td>'
. $user . '</td>
            </tr>
            <tr>
                   <td>Date:</td>
                <td>'
. $date . '</td>
            </tr>
            <tr>
                   <td>Reaction:</td>
                <td>'
.  $content . '</td>
              </tr>
        </table>
        <br />'
;
    }
else {
        echo "There are no reactions yet!<br />
        Please fill in the box below to add your reactions on this news!<br /><br />"
.
        $textbox;
    }
}

echo "<hr class='content_hr' />" . $textbox;
?>

<?php
$date
      = date("jS F, Y");
$creator  = $_POST['creator'];
$subject  = "Tijdelijk subject";
$user       = "Tijdelijk user";
$melding  = "Reactie: ". $_POST['reaction'] ." is met succes geplaats!";
if($_SERVER['REQUEST_METHOD'] == "POST") {
        $sql  = 'INSERT INTO news_reactions
        (id_news, subject, user, time, date, content)
        VALUES
        ("'
. 10 . '",
        "'
. mysql_real_escape_string( $subject ) . '",
        "'
. mysql_real_escape_string( $user ) . '",
        NOW(),
        "'
. mysql_real_escape_string( $date ) . '",
        "'
. mysql_real_escape_string( $_POST['your_reaction'] ) . '")';
$query = mysql_query($sql) or die (mysql_error());
            echo $melding;
    }
}

?>

</table>
</form>
           </td>
        <td width="150"></td>
        <td width="160" valign="top">
            <strong>Updates:</strong>
            <hr class="content_hr" />
        </td>
    </tr>
</table>


Dit was m'n code.

Iemand enig idee waarom hij niets insert?
Gewijzigd op 01/01/1970 01:00:00 door [email protected]
 
PHP hulp

PHP hulp

26/04/2024 13:47:49
 
Max S

Max S

12/03/2009 17:21:00
Quote Anchor link
Op regel 101:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
        "' . mysql_real_escape_string( $_POST['your_reaction'] ) . '")';

Daar staat je ) buiten je ", die moet er toch in staan...
 
- SanThe -

- SanThe -

12/03/2009 17:23:00
Quote Anchor link
Zet dit bovenin je script.
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

// rest
?>
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.