Make a stripped-down stylesheet for the editor to use.
Make a stripped-down stylesheet for the editor to use.

File last commit:

c1e4c31f199d
d3add6d85bd7
Show More
mysql.php
50 lines | 1.1 KiB | text/x-php | PhpLexer
<?php
class MysqlStore {
var $link;
function connect($server,$user,$pass,$dbname) {
$this->link = @mysql_connect($server, $user, $pass)
or mtdie('Could not connect to the database server.');
@mysql_select_db($dbname, $this->link)
or mtdie('Could not open the megatokyo database.');
if( !$this->link ) mtdie('Could not connect to the database server.');
}
function query($sql, $showerror = true ) {
$r = mysql_query( $sql, $this->link );
if( false === $r && $showerror ) echo mysql_error();
return $r;
}
function getAll($sql) {
if( $r = $this->query( $sql ) ) {
$ret = array();
while( $row = mysql_fetch_object( $r ) ) {
$ret[] = $row;
}
return $ret;
}
}
function getRow($sql) {
if( $r = $this->query( $sql ) ) {
if( false === $r ) {
echo mysql_error();
return false;
}
if( mysql_num_rows( $r ) == 0 ) return false;
return mysql_fetch_object( $r );
}
}
function getOne($sql) {
if( $r = $this->query( $sql ) ) {
if( mysql_num_rows( $r ) == 0 ) return false;
$ret = mysql_fetch_row( $r );
return $ret[0];
}
}
}
?>