Switch more PHP files to use the DBAL.
Switch more PHP files to use the DBAL.

File last commit:

c3da001f5ff1
749c3253f5e9
Show More
mysql.php
48 lines | 1.0 KiB | text/x-php | PhpLexer
Add most necessary files for admin interface.
r1 <?php
class MysqlStore {
var $link;
Convert mysql.php to use mysqli interface.
r3
function connect($server, $user, $pass, $dbname) {
$this->link = @mysqli_connect($server, $user, $pass, $dbname)
Add most necessary files for admin interface.
r1 or mtdie('Could not connect to the database server.');
Convert mysql.php to use mysqli interface.
r3 if( !$this->link ) mtdie('Could not connect to the database server.');
Add most necessary files for admin interface.
r1 }
function query($sql, $showerror = true ) {
Convert mysql.php to use mysqli interface.
r3 $r = mysqli_query( $this->link, $sql );
Fix calls to mysqli_error().
r7 if( false === $r && $showerror ) echo mysqli_error($this->link);
Add most necessary files for admin interface.
r1 return $r;
}
Convert mysql.php to use mysqli interface.
r3
Add most necessary files for admin interface.
r1 function getAll($sql) {
if( $r = $this->query( $sql ) ) {
$ret = array();
Convert mysql.php to use mysqli interface.
r3 while( $row = mysqli_fetch_object( $r ) ) {
Add most necessary files for admin interface.
r1 $ret[] = $row;
}
return $ret;
}
}
Convert mysql.php to use mysqli interface.
r3
Add most necessary files for admin interface.
r1 function getRow($sql) {
if( $r = $this->query( $sql ) ) {
if( false === $r ) {
Fix calls to mysqli_error().
r7 echo mysqli_error($this->link);
Add most necessary files for admin interface.
r1 return false;
}
Convert mysql.php to use mysqli interface.
r3 if( mysqli_num_rows( $r ) == 0 ) return false;
return mysqli_fetch_object( $r );
Add most necessary files for admin interface.
r1 }
}
Convert mysql.php to use mysqli interface.
r3
Add most necessary files for admin interface.
r1 function getOne($sql) {
if( $r = $this->query( $sql ) ) {
Convert mysql.php to use mysqli interface.
r3 if( mysqli_num_rows( $r ) == 0 ) return false;
$ret = mysqli_fetch_row( $r );
Add most necessary files for admin interface.
r1 return $ret[0];
}
}
}
Convert mysql.php to use mysqli interface.
r3 ?>