The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting records failed
#1
Hi Folks,

I have created form using form builder and this form has to be accessed by the users without login and submit the form and the same has to be saved inside the db but so far its not happening.

form posting php as follows i.e. abc.php

<?php require_once './users/init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>


<div id="page-wrapper">
<div class="container">
<?php

if($_POST){
   //print_r($_POST);exit;

   $db = DB::getInstance();


[font=Droid Sans Mono]
    try {
       // echo "Trying to create user";
       $fields=array(
[/font]

[font=Droid Sans Mono][font=Droid Sans Mono]         'var1' => Input::get('[font=Droid Sans Mono]var1'),
         'var2' => ucfirst(Input::get('var2')),
         'var3' =>  Input::get('var3'),[/font]
[/font]
[/font]

[font=Droid Sans Mono][font=Droid Sans Mono]       );
       print_r($fields);
       var_dump($db);
       $db->insert('tablename',$fields) or die("not able to create record");exit;
       $theNewId=$db->lastId();
[/font]
[/font]

[font=Droid Sans Mono][font=Droid Sans Mono]}[/font][/font]
[font=Droid Sans Mono][font=Droid Sans Mono][font=Droid Sans Mono]displayForm('abcform');[/font][/font][/font]
[font=Droid Sans Mono][font=Droid Sans Mono]abc.php has be defined as public and error I am getting as follows[/font][/font]

[font=Droid Sans Mono][font=Droid Sans Mono]object(DB)#8 (9) { ["_pdo":"DB":private]=> object(PDO)#6 (0) { } ["_query":"DB":private]=> object(PDOStatement)#32 (1) { ["queryString"]=> string(50) "SELECT id, page, private FROM pages WHERE page = ?" } ["_error":"DB":private]=> bool(false) ["_errorInfo":"DB":private]=> array(3) { [0]=> int(0) [1]=> NULL [2]=> NULL } ["_results":"DB":private]=> array(1) { [0]=> object(stdClass)#31 (3) { ["id"]=> string(2) "87" ["page"]=> string(14) "abc.php" ["private"]=> string(1) "0" } } ["_resultsArray":"DB":private]=> array(1) { [0]=> array(3) { ["id"]=> string(2) "87" ["page"]=> string(14) "abc.php" ["private"]=> string(1) "0" } } ["_count":"DB":private]=> int(1) ["_lastId":"DB":private]=> string(1) "0" ["_queryCount":"DB":private]=> int(51) } not able to create record[/font][/font]

[font=Droid Sans Mono][font=Droid Sans Mono]I am struck here please someone help me[/font][/font]
  Reply


Messages In This Thread
Inserting records failed - by vkkan - 10-07-2018, 12:52 PM
RE: Inserting records failed - by Brandin - 10-07-2018, 08:39 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)