Update include/*.php to use mysqli_* functions.
Update include/*.php to use mysqli_* functions.

File last commit:

a17e7e96d006
2f20c7105050
Show More
mysql.php
48 lines | 1.0 KiB | text/x-php | PhpLexer
<?php
class MysqlStore {
var $link;
function connect($server, $user, $pass, $dbname) {
$this->link = @mysqli_connect($server, $user, $pass, $dbname)
or mtdie('Could not connect to the database server.');
if( !$this->link ) mtdie('Could not connect to the database server.');
}
function query($sql, $showerror = true ) {
$r = mysqli_query( $this->link, $sql );
if( false === $r && $showerror ) echo mysqli_error();
return $r;
}
function getAll($sql) {
if( $r = $this->query( $sql ) ) {
$ret = array();
while( $row = mysqli_fetch_object( $r ) ) {
$ret[] = $row;
}
return $ret;
}
}
function getRow($sql) {
if( $r = $this->query( $sql ) ) {
if( false === $r ) {
echo mysqli_error();
return false;
}
if( mysqli_num_rows( $r ) == 0 ) return false;
return mysqli_fetch_object( $r );
}
}
function getOne($sql) {
if( $r = $this->query( $sql ) ) {
if( mysqli_num_rows( $r ) == 0 ) return false;
$ret = mysqli_fetch_row( $r );
return $ret[0];
}
}
}
?>