Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 285 van 286

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Azdinnn schreef:
Nee, je gaat er geen winst op maken neem ik aan yummie
Nee, gewoon geheel gratis, net zoals woelmuis ofzo.
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Azdinnn schreef:
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connection.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// Configuratie[/COLOR]
[COLOR= #0000BB]$tekstLimiet[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]25000[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Maximaal aantal karakters[/COLOR]
[COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR] [COLOR= #FF8000]// Fouten afhandeling [/COLOR]

[COLOR= #0000BB]$controleQuery[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM kladblok WHERE ip = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$controleQuFetch[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$controleQuery[/COLOR][COLOR= #007700]->[/COLOR]fetch_assoc[COLOR= #007700]();[/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/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]) >=[/COLOR] [COLOR= #0000BB]$tekstLimiet[/COLOR][COLOR= #007700])[/COLOR]
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je tekst is te lang om opgeslagen te worden.[/COLOR][COLOR= #007700];[/COLOR]
        
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) ===[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je kladblok is opgeslagen[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$controleQuery[/COLOR][COLOR= #007700]->[/COLOR]num_rows [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE kladblok SET 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]", aangepast_op = NOW() WHERE  ip = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]

            [COLOR= #0000BB]$mysql[/COLOR][COLOR= #007700]->[/COLOR]query[COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO kladblok ( bericht, ip, aangepast_op ) VALUES ( "[/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]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", NOW())"[/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]<font color="#DF0005"><strong>Er [/COLOR][COLOR= #007700].([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]zijn meerdere fouten[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000]is &eacute;&eacute;n fout[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000] gevonden:</strong><br /><ul>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$val[/COLOR][COLOR= #007700]) 
        {[/COLOR]
        
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<li>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$val[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]</li>[/COLOR][COLOR= #007700];
            
        }[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</ul></font>[/COLOR][COLOR= #007700];
        
    }
    
}[/COLOR]

?>
Ik krijg de volgende error:
PHP Fatal error: Call to a member function query() on a non-object in C:***test.php on line 7

Iemand een idee?

Je gebruikt toch mysql? Dan moet je die $mysqli->query vervangen door mysql_query. Al raad ik je MYSQL niet aan, maar oke.
0
Berichten
21.633
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja ik gebruik MySQL, ik heb gedaan wat je zei en nu krijg ik dit:
PHP Fatal error: Call to a member function fetch_assoc() on a non-object in C:**test.php on line 8
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Azdinnn schreef:
Ja ik gebruik MySQL, ik heb gedaan wat je zei en nu krijg ik dit:
PHP Fatal error: Call to a member function fetch_assoc() on a non-object in C:**test.php on line 8
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]connection.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// Configuratie[/COLOR]
[COLOR= #0000BB]$tekstLimiet[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]25000[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]// Maximaal aantal karakters[/COLOR]
[COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR] [COLOR= #FF8000]// Fouten afhandeling [/COLOR]

[COLOR= #0000BB]$controleQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM kladblok WHERE ip = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$controleQuFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$controleQuery[/COLOR][COLOR= #007700]);[/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/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]) >=[/COLOR] [COLOR= #0000BB]$tekstLimiet[/COLOR][COLOR= #007700])[/COLOR]
        [COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je tekst is te lang om opgeslagen te worden.[/COLOR][COLOR= #007700];[/COLOR]
        
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) ===[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
    {[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je kladblok is opgeslagen[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$controleQuFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE kladblok SET 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]", aangepast_op = NOW() WHERE  ip = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
        }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
        [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO kladblok ( bericht, ip, aangepast_op ) VALUES ( "[/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]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", NOW())"[/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]<font color="#DF0005"><strong>Er [/COLOR][COLOR= #007700].([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR][COLOR= #007700]) >[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]zijn meerdere fouten[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000]is &eacute;&eacute;n fout[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000] gevonden:</strong><br /><ul>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fouten[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$val[/COLOR][COLOR= #007700]) 
        {[/COLOR]
        
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<li>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$val[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]</li>[/COLOR][COLOR= #007700];
            
        }[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</ul></font>[/COLOR][COLOR= #007700];
        
    }
    
}[/COLOR]

?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Beter verdiep je je in MySQLi, die gaat uiteindelijke mysql overheersen qua functies.
0
Berichten
21.633
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nu werkt het, maar als ik iets wil opslaan (kladblok) dan krijg ik de volgende error:
PHP Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:***test.php on line 21
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Dan mist er foutafhandeling.

if(mysql_num_rows($controleQuFetch[bericht]) == 1)

Dit kan ook niet, in $controleQuFetch[bericht] zit geen query-resource.
0
Fass

Lid

Berichten
3.771
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Beter verdiep je je in MySQLi, die gaat uiteindelijke mysql overheersen qua functies.
Ik hoor meer dat de toekomst zit in PDO? yummie
0
Berichten
4.214
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe krijg ik dit stukje jQuery werkend voor alle elementen met het id "select"?

$("#select").click(function() {
        this.select();
    });


Nu werkt het alleen maar op het eerste element met het id "select".
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Timkb schreef:
Hoe krijg ik dit stukje jQuery werkend voor alle elementen met het id "select"?
$("#select").click(function() {
        this.select();
    });


Nu werkt het alleen maar op het eerste element met het id "select".

Basic HTML:

IDs zijn voor elementen die er maar 1x zijn
CLASSES zijn voor elementen die meerdere keren (kunnen) voorkomen
0
Berichten
4.214
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nielsie schreef:
Eerdere citaten tonen
Timkb schreef:
Hoe krijg ik dit stukje jQuery werkend voor alle elementen met het id "select"?
$("#select").click(function() {
        this.select();
    });


Nu werkt het alleen maar op het eerste element met het id "select".
Basic HTML:

IDs zijn voor elementen die er maar 1x zijn
CLASSES zijn voor elementen die meerdere keren (kunnen) voorkomen

Die logica snap ik, helaas moet je soms aan een site sleutelen van een klant waar de vorige developer er een puinhoop van heeft gemaakt. De klant geen complete renovatie omdat daar het budget niet naar staat dus ga ik dat ook niet doen en dus moet het zo. Als het niet mogelijk is; helaas.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Je MOET alle elementen met het id select een class geven om het te kunnen doen
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Fass schreef:
Eerdere citaten tonen
Aarclay schreef:
Beter verdiep je je in MySQLi, die gaat uiteindelijke mysql overheersen qua functies.
Ik hoor meer dat de toekomst zit in PDO? yummie
Kan ook, maar dat is objectgeorienteerd, mysqli kan nog procedureel worden gebruikt.
0
Berichten
21.633
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Dan mist er foutafhandeling.
if(mysql_num_rows($controleQuFetch[bericht]) == 1)

Dit kan ook niet, in $controleQuFetch[bericht] zit geen query-resource.
Hoe zou het dan wel moeten..
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