Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class main
- {
- private $host = "localhost";
- private $user = "root";
- private $pass = "";
- private $db = "laboratory";
- public function __construct() {
- $this->link = mysql_connect("$this->host","$this->user","$this->pass");
- mysql_select_db($this->db,$this->link);
- }
- public function insert($tbl,$data) {
- $this->tbl = $tbl;
- foreach ($this->data = $data as $name=>$value)
- {
- $this->insert_first[] = $name;
- $this->insert_last[]= mysql_real_escape_string($value);
- $this->results[$name] = $value;
- }
- $this->insert_first = '('.implode(',',$this->insert_first).')';
- $this->insert_last = "('".implode("','",$this->insert_last)."')";
- mysql_query("INSERT INTO $this->tbl $this->insert_first VALUES $this->insert_last ") or die (mysql_error());
- return ($this->results);
- }
- public function
- public function __destruct() {
- mysql_close($this->link);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement