Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result
Code (php)
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
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
<?php
// Load the common classes
require_once('includes/common/KT_common.php');
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("");
// Make unified connection variable
$conn_con_gastenboek = new KT_connection($con_gastenboek, $database_con_gastenboek);
// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("emailaddress", true, "text", "email", "", "", "");
$formValidation->addField("website", false, "text", "url", "", "", "");
$formValidation->addField("onderwerp", true, "text", "", "", "", "");
$formValidation->addField("message", true, "text", "", "", "", "");
$tNGs->prepareValidation($formValidation);
// End trigger
//start CheckCaptcha trigger
//remove this line if you want to edit the code by hand
function CheckCaptcha(&$tNG) {
$captcha = new tNG_Captcha("captcha_id_id", $tNG);
$captcha->setFormField("POST", "captcha_id");
$captcha->setErrorMsg("Code komt niet overeen met de afbeelding");
return $captcha->Execute();
}
//end CheckCaptcha trigger
// Make an insert transaction instance
$ins_users = new tNG_insert($con_gastenboek, $conn_con_gastenboek);
$tNGs->addTransaction($ins_users);
// Register triggers
$ins_users->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_users->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_users->registerTrigger("END", "Trigger_Default_Redirect", 99, "gastenboekb.php");
$ins_users->registerTrigger("BEFORE", "CheckCaptcha", 10);
// Add columns
$ins_users->setTable("users");
$ins_users->addColumn("username", "STRING_TYPE", "POST", "username");
$ins_users->addColumn("emailaddress", "STRING_TYPE", "POST", "emailaddress");
$ins_users->addColumn("onderwerp", "STRING_TYPE", "POST", "onderwerp");
$ins_users->addColumn("message", "STRING_TYPE", "POST", "message");
$ins_users->addColumn("datum_van", "STRING_TYPE", "POST", "datumveld");
$ins_users->setPrimaryKey("userid", "NUMERIC_TYPE");
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset ************ hieronder staan de twee en derde regel die de fout geven****
$rsusers = $tNGs->getRecordset("users");
$row_rsusers = mysqli_fetch_assoc($rsusers);
$totalRows_rsusers = mysqli_num_rows($rsusers);
// Captcha Image
$captcha_id_obj = new KT_CaptchaImage("captcha_id_id");
// datum bepalen //
$vandaag = date("Y-m-d");
// einde datum //
?>
// Load the common classes
require_once('includes/common/KT_common.php');
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("");
// Make unified connection variable
$conn_con_gastenboek = new KT_connection($con_gastenboek, $database_con_gastenboek);
// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("emailaddress", true, "text", "email", "", "", "");
$formValidation->addField("website", false, "text", "url", "", "", "");
$formValidation->addField("onderwerp", true, "text", "", "", "", "");
$formValidation->addField("message", true, "text", "", "", "", "");
$tNGs->prepareValidation($formValidation);
// End trigger
//start CheckCaptcha trigger
//remove this line if you want to edit the code by hand
function CheckCaptcha(&$tNG) {
$captcha = new tNG_Captcha("captcha_id_id", $tNG);
$captcha->setFormField("POST", "captcha_id");
$captcha->setErrorMsg("Code komt niet overeen met de afbeelding");
return $captcha->Execute();
}
//end CheckCaptcha trigger
// Make an insert transaction instance
$ins_users = new tNG_insert($con_gastenboek, $conn_con_gastenboek);
$tNGs->addTransaction($ins_users);
// Register triggers
$ins_users->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
$ins_users->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$ins_users->registerTrigger("END", "Trigger_Default_Redirect", 99, "gastenboekb.php");
$ins_users->registerTrigger("BEFORE", "CheckCaptcha", 10);
// Add columns
$ins_users->setTable("users");
$ins_users->addColumn("username", "STRING_TYPE", "POST", "username");
$ins_users->addColumn("emailaddress", "STRING_TYPE", "POST", "emailaddress");
$ins_users->addColumn("onderwerp", "STRING_TYPE", "POST", "onderwerp");
$ins_users->addColumn("message", "STRING_TYPE", "POST", "message");
$ins_users->addColumn("datum_van", "STRING_TYPE", "POST", "datumveld");
$ins_users->setPrimaryKey("userid", "NUMERIC_TYPE");
// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset ************ hieronder staan de twee en derde regel die de fout geven****
$rsusers = $tNGs->getRecordset("users");
$row_rsusers = mysqli_fetch_assoc($rsusers);
$totalRows_rsusers = mysqli_num_rows($rsusers);
// Captcha Image
$captcha_id_obj = new KT_CaptchaImage("captcha_id_id");
// datum bepalen //
$vandaag = date("Y-m-d");
// einde datum //
?>
Wat zegt var_dump() over $rsusers?
$captcha_id_obj = new KT_CaptchaImage("captcha_id_id");
// datum bepalen //
$vandaag = date("Y-m-d");
// einde datum //
var_dump()
?>
http://hermans-motorhomes.ophetweb.nu/gastenboekb_ingeven.php
geeft dit resultaat. Warning: var_dump() expects at least 1 parameter, 0 given in C:\domains\hermans-motorhomes.be\wwwroot\gastenboekb_ingeven.php on line 65
object(KT_fakeADORecordset)#7 (6) { ["allFields"]=> array(1) { [0]=> array(12) { ["username"]=> string(0) "" [0]=> string(0) "" ["emailaddress"]=> string(0) "" [1]=> string(0) "" ["onderwerp"]=> string(0) "" [2]=> string(0) "" ["message"]=> string(0) "" [3]=> string(0) "" ["datum_van"]=> string(0) "" [4]=> string(0) "" ["userid"]=> string(0) "" [5]=> string(0) "" } } ["fields"]=> array(12) { ["username"]=> string(0) "" [0]=> string(0) "" ["emailaddress"]=> string(0) "" [1]=> string(0) "" ["onderwerp"]=> string(0) "" [2]=> string(0) "" ["message"]=> string(0) "" [3]=> string(0) "" ["datum_van"]=> string(0) "" [4]=> string(0) "" ["userid"]=> string(0) "" [5]=> string(0) "" } ["index"]=> int(0) ["EOF"]=> bool(false) ["_numOfRows"]=> int(1) ["_numOfFields"]=> int(6) }
mysqli_fetch_assoc($rsusers) verwacht een resultset als parameter.
Gaat dus niet samen.
Ook is er nog een probleem met de captia code, maar misschien beter stap voor stap.
Waar komt: getRecordset() vandaan?