Azdinnn schreef:Nee, gewoon geheel gratis, net zoals woelmuis ofzo.Nee, je gaat er geen winst op maken neem ik aan
Kleine Vragen Topic #1
Azdinnn schreef:http://php.net/manual/en/mysqli.query.phpHoe zou ik regel 7 dan moeten doen?
Azdinnn schreef:Ik krijg de volgende error: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 éé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] ?>
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.
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
PHP Fatal error: Call to a member function fetch_assoc() on a non-object in C:**test.php on line 8
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 éé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]
?> Beter verdiep je je in MySQLi, die gaat uiteindelijke mysql overheersen qua functies.
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
PHP Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:***test.php on line 21
Dan mist er foutafhandeling.
if(mysql_num_rows($controleQuFetch[bericht]) == 1)
Dit kan ook niet, in $controleQuFetch[bericht] zit geen query-resource.
if(mysql_num_rows($controleQuFetch[bericht]) == 1)
Dit kan ook niet, in $controleQuFetch[bericht] zit geen query-resource.
Aarclay schreef:Ik hoor meer dat de toekomst zit in PDO?Beter verdiep je je in MySQLi, die gaat uiteindelijke mysql overheersen qua functies.

Hoe krijg ik dit stukje jQuery werkend voor alle elementen met het id "select"?
Nu werkt het alleen maar op het eerste element met het id "select".
$("#select").click(function() {
this.select();
}); Nu werkt het alleen maar op het eerste element met het id "select".
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
Nielsie schreef:Basic HTML: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".
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.
Je MOET alle elementen met het id select een class geven om het te kunnen doen
Fass schreef:Kan ook, maar dat is objectgeorienteerd, mysqli kan nog procedureel worden gebruikt.Ik hoor meer dat de toekomst zit in PDO?Eerdere citaten tonen
Aarclay schreef:Beter verdiep je je in MySQLi, die gaat uiteindelijke mysql overheersen qua functies.
Aarclay schreef:if(mysql_num_rows($controleQuFetch[bericht]) == 1)Dan mist er foutafhandeling.
Dit kan ook niet, in $controleQuFetch[bericht] zit geen query-resource.
Hoe zou het dan wel moeten..