Gejadze

Gejadze supports this item

Supported

This author's response time can be up to 2 business days.

29 comments found.

Me to same as polarhosea just getting

Database to Class Generator Available tables in xxxx_webDatabase:

were do i get the help file

Hi, I’m having problems with the WHERE clause for paginate method. I want to send in WHERE active = 1 but when I run the page I just get the error: “Undefined index..” in the loop where the data should display. The all() method works fine and there are records where active = 1.

What am I missing?

Thanks!

Hello,

$where argument for Paginate method Must be array. example:
$result = $your_classname->paginate($page = 1, $limit = 10, $where=array("active" => "1"));

if this does not help, please email me the code you are using and I will try to help.

best

Thanks that works.

K

if I create a form and I have several employees that need to access them to enter info or update info without getting to the management section, can we do that?

$det_extcolors = new det_extcolors(); $det_extcolors->name = “Vikram”; $det_extcolors->active = 0; $det_extcolors->order = 0;

if($det_extcolors->add()){ echo “Record was added sucessfully”; }else{ echo “Oops, Something went wrong, record was not added”; }

===================================

public function add() { $bindings = $this->variables; if (!empty($bindings)): $fields = array_keys($bindings); $fieldsvals = array(implode(”,, $fields), . implode(”,:”, $fields)); $sql = “INSERT INTO ” . $this->table . ” (” . $fieldsvals0 . “) VALUES (” . $fieldsvals1 . “)”; else: return false; endif; $this->db->query($sql, $bindings); return $this->db->lastInsertId(); }

I am getting this error:

Ooops, There is an Error:

SQLSTATE42000: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘order) VALUES (?,?,?)’ at line 1

Raw SQL : INSERT INTO det_extcolors (name,active,order) VALUES (:name,:active,:order)

  1. Name Type Collation Attributes Null Default Extra 1 id int(10) UNSIGNED No None AUTO_INCREMENT 2 name varchar(255) utf8_unicode_ci No None 3 active tinyint(1) No None 4 order int(11) No None

Hello,

sorry about that, quick fix would be to modify det_extcolors::add() function so it looks like this:

public function add() {
        $bindings = $this->variables;
        if (!empty($bindings)):
            $fields = array_keys($bindings);
            $fieldsvals = array("`".implode("`,`", $fields)."`", ":" . implode(",:", $fields));
            $sql = "INSERT INTO " . $this->table . " (" . $fieldsvals[0] . ") VALUES (" . $fieldsvals[1] . ")";
        else:
            return false;
        endif;
        $this->db->query($sql, $bindings);
        return $this->db->lastInsertId();
    }

I have modified $fieldsvals array to escape column names.

for permanent fix, you can modify Classes/ClassGenerator.php line 277. Change
$fieldsvals = array(implode(",", $fields), ":" . implode(",:", $fields));
with
$fieldsvals = array("`".implode("`,`", $fields)."`", ":" . implode(",:", $fields));

Regards

Thank you. I will do it

Within the paginate WHERE clauses is there a way to use LIKE and BETWEEN to get results?

Thanks, K

Do you have a live demo?

aag

aag Purchased

Nice Script.

Ooops, There is an Error:

SQLSTATE42000: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘keys’ at line 1

Raw SQL : SHOW COLUMNS FROM keys

by
by
by
by
by
by