public function insert($current_class, $name, $address) { $this->current_class = $current_class; $this->key = getRandomKey(); $this->name = $name; $this->address = $address; $this->db->insert('students', $this); return $this->key; }
$id = $row['id']; $id = $row['id']; } // Insert into custom if ($custom) { if (preg_match("|[\\w-]{4,}|", $custom)) { $sqli->query("INSERT INTO `mapping` VALUES('{$custom}', {$id})"); if ($sqli->errno == 1062) { $PARCEL['error'] = "Entry " . $custom . " is already taken"; } } else { $PARCEL['error'] = "Custom text must be atleast 4 characters long containing only alphanumeric characters, dash and underscore."; } } else { do { $custom = getRandomKey(4); $sqli->query("INSERT INTO `mapping` VALUES('{$custom}', {$id})"); } while ($sqli->errno == 1062); } $PARCEL['url'] = $custom; $sqli->close(); } } else { $PARCEL['error'] = "Malformed URL"; } if ($no_js == "false") { echo json_encode($PARCEL); } //print_r($PARCEL); } else { if ($_SERVER['REQUEST_METHOD'] === "GET" && isset($_GET['key'])) {