/ Published in: PHP
Write less and do more mysql in php.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //Written by: Shreyas Basarge class mysql { var $conn; var $error; function get_error() { return $this->error; } function connect($dbname) { if (!!$this->conn) { return true; } return false; } function insert($table, $dataarray) { $i = 0; $data = ''; { $data .= "'" . $dataarray[$i] . "'"; $i++; } { return true; } else { return false; } } function query($q) { { return $result; } else { return false; } } function update($table, $fields, $values, $clause) { { return false; } $sql = "UPDATE $table SET "; $i=0; { $sql = $sql . $fields[$i] . " = '" . $values[$i] . "'"; $i++; } $sql = $sql + " WHERE $clause"; } { return $row["MAX($field)"]; } function getfields($table) { { return $cms['Field']; } else { return false; } } function getrows($table,$fields, $clause=NULL, $order=NULL, $llimit=NULL, $ulimit=NULL) { $sql = "SELECT "; $sql .= ($fields != '')? $fields . " " : "* "; $sql .= "FROM $table "; if ($order != '') $sql .= "ORDER BY $order "; $sql .= ";"; { return $result; } else { return false; } } function getrow($table, $fields=NULL, $clause=NULL) { $rows = $this->getrows($table, $fields, $clause, '', 0, 1); else return false; } function nextrow($rows) { } function delete($table, $clause) { } function close() { } } ?>