Fout in me script

Gestart doorKrm9 reacties20 weergaven

10 berichten · pagina 1 van 1

Krm

Lid · Topicstarter

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een fout in me script maar kan niet vinden wat kunnen jullie me helpen.

Fatal error: Call to a member function query() on a non-object in /home/davebode/domains/hefbandi.nl/public_html/testt.php on line 111


Regel 111 is
if($mysql->query($sql))
Spoiler tonen
[COLOR= #0000BB]<?[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ===[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])
            {[/COLOR]
            
                [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #DD0000][/COLOR] [COLOR= #007700]||[/COLOR] [URL="http://www.php.net/trim"]trim[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #DD0000][/COLOR] [COLOR= #007700])
                {[/COLOR]
                
                    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]U heeft niet alle velden goed ingevuld.[/COLOR][COLOR= #007700];
                
                }[/COLOR]
                [URL="http://www.php.net/else"]else[/URL]
                [COLOR= #007700]{[/COLOR]
                
                    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"UPDATE nieuws SET
                            titel = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                            bericht = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
                            WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
                            
                
                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]))
                    {[/COLOR]
                
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Succesvol geëdit[/COLOR][COLOR= #007700];
                    
                    }[/COLOR]
                    [URL="http://www.php.net/else"]else[/URL]
                    [COLOR= #007700]{[/COLOR]
                    
                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Fout in het editen, probeer het later opnieuw[/COLOR][COLOR= #007700];
                    
                    }
                
                }            
            
            }[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
            [COLOR= #007700]{[/COLOR]                
                ?>
                <h1>Nieuws</h1><br />
                 <h3> <strong>Nieuws bewerken</strong></h3> <hr noshade="noshade" size="1" />
                     <form name="form1" method="post" action="">
                <br />
                <strong>Bericht</strong><br>
                <textarea name="bericht" cols="70" rows="13" class="textarea">[COLOR= #0000BB]<?[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"$bericht"[/COLOR][COLOR= #007700];[/COLOR] ?></textarea>
                    <br />
                <strong>Titel</strong><br />
                    <input class="input" type="text" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"$titel"[/COLOR][COLOR= #007700];[/COLOR] ?>" name="titel">
                    <br>
                    <br>
                    <input type="submit" name="Submit" value="Editen">         
                    </form>
                
                
                [COLOR= #0000BB]<?php[/COLOR]
            [COLOR= #007700]}[/COLOR]
        
        
?>
0
Berichten
2.052
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
iets in je database?/..
0
Krm

Lid · Topicstarter

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
alles werkt verder
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bestaat $mysql wel?
0
Krm

Lid · Topicstarter

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat klopt hier niet aan
hij zegt succesvol gewijzigd maar blijft het zelfde

[COLOR= #0000BB]<?php[/COLOR]    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE nieuws SET titel="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", bericht="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" WHERE id "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Succesvol gewijzigd!<br />"[/COLOR][COLOR= #007700];
    }[/COLOR]
    ?>
<form name="form1" id="form1" method="post" action="">
<strong>Bericht</strong> <em>(In dit tekstvak kan HTML  worden gebruikt. &lt;br /&gt; Hoeft niet toegevoegd te worden.) </em><br>
<textarea name="bericht" id="bericht" cols="70" rows="13" class="textarea">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/stripslashes"]stripslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700]);[/COLOR] ?></textarea>
      Titel:<br />
      <input name="titel" type="text" id="titel" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"$titel"[/COLOR][COLOR= #007700];[/COLOR] ?>" />
      <br />
      <input type="submit" name="Submit" value="Verstuur &gt;&gt;" />
    </form>
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
    [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE nieuws SET titel="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]", bericht ="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]" WHERE id = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"Succesvol gewijzigd!<br />"[/COLOR][COLOR= #007700];
    }[/COLOR]
    ?>


Je bent een = vergeten na de id smile
0
Krm

Lid · Topicstarter

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ty ik word moe manyummie
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kerem schreef:
Ty ik word moe manyummie
Hahaa, je moet ook niet scripten als je moe bent. Heb ik nu ook geen zin in scripten schater
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En zet volgende keer

or die(mysql_error());


achter je query
0
Krm

Lid · Topicstarter

Berichten
6.235
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dat stond er eerst ook. Maar ik ging de dingen eronder verder testen en de fout stond zo lelijk
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren