Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result reso

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Arend b

arend b

07/08/2008 11:00:00
Quote Anchor link
hallo,

daar ben ik weer met een vraag over een error. als het volgende script run krijg ik de volgende error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\test\shoutbox.php on line 15

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
<?php
include "dbconnect.php";
    if ($_GET['actie'] == 'add') {
    $datum = date("y-m-d : H:i:s",time());
    $naam = $_POST['name'];;
    $textadd = $_POST['textcomment'];
    if ($naam=="") { $naam="Anoniempje";}
    $add = "INSERT INTO shout (text, user, datum) VALUES ('$textadd', '$naam', '$datum')";
    mysql_query($add) or die(mysql_error());
    }

    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
    echo "<tr><th colspan=\"2\" align=\"left\">Shoutbox</th></tr>";
    $sql = "SELECT * FROM shout ORDER BY datum DESC LIMIT 3";
    $shout = mysql_query($sql) or die(mysql_error());
    while ($rij = mysql_fetch_assoc($shout)) {
       $count++;
           if ($count%2 > 0) { $color="#d2d2d2";}else{$color="#737373";    }
         $shout = $rij[text];
       $naamshout = $rij[user];
         $datum = $rij[datum];
       echo "<tr bgcolor='$color'><td width=\"55\">$naamshout $datum</td><td width=\"185\">$shout</td></tr>";
    }

    echo "</table><br />";
    echo "<form action=\"".$_SERVER['PHP_SELF']."?actie=add\" method=\"post\">";
    echo "<input type=\"text\" name=\"name\" size=\"25\"><br />";
    echo "<textarea name=\"textcomment\" row=\"25\">";
    echo "</textarea>";
    echo "<input type=\"submit\" value=\"Post comment\">";
    echo "</form></div>";
?>


Hoe krijg ik deze melding weg?
 
PHP hulp

PHP hulp

02/05/2024 05:33:50
 
- wes  -

- wes -

07/08/2008 11:04:00
 
Jacco Engel

Jacco Engel

07/08/2008 11:08:00
 
Arend b

arend b

07/08/2008 11:09:00
Quote Anchor link
bedankt voor je reactie

alleen blijft de melding hetzelfde:(

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
<?php
include "dbconnect.php";
    if ($_GET['actie'] == 'add') {
    $datum = date("y-m-d : H:i:s",time());
    $naam = $_POST['name'];;
    $textadd = $_POST['textcomment'];
    if ($naam=="") { $naam="Anoniempje";}
    $add = "INSERT INTO shout (text, user, datum) VALUES ('$textadd', '$naam', '$datum')";
    mysql_query($add) or die(mysql_error());
    }

    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
    echo "<tr><th colspan=\"2\" align=\"left\">Shoutbox</th></tr>";
    $sql = "SELECT * FROM shout ORDER BY datum DESC LIMIT 3";
    $shout = mysql_query($sql) or die(mysql_error());
    if ($shout && mysql_num_rows($shout) >= 1) {
    while ($rij = mysql_fetch_assoc($shout)) {
       $count++;
           if ($count%2 > 0) { $color="#d2d2d2";}else{$color="#737373";    }
         $shout = $rij[text];
       $naamshout = $rij[user];
         $datum = $rij[datum];
       echo "<tr bgcolor='$color'><td width=\"55\">$naamshout $datum</td><td width=\"185\">$shout</td></tr>";
    }
    }
else {
       echo "Geen data gevonden";
    }

    echo "</table><br />";
    echo "<form action=\"".$_SERVER['PHP_SELF']."?actie=add\" method=\"post\">";
    echo "<input type=\"text\" name=\"name\" size=\"25\"><br />";
    echo "<textarea name=\"textcomment\" row=\"25\">";
    echo "</textarea>";
    echo "<input type=\"submit\" value=\"Post comment\">";
    echo "</form></div>";
?>


Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\test\shoutbox.php on line 16

Shoutbox
Test 2008-08-07 10:43:57 shout
Gewijzigd op 01/01/1970 01:00:00 door arend b
 
Arend b

arend b

07/08/2008 12:02:00
Quote Anchor link
Jacco schreef op 07.08.2008 11:08:


Heb ik al gezocht maar ik werd er niet veel wijzer van want bij mij geeft die wel een output maar ook een foutmelding
 



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.