Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //error_reporting(E_ALL);
- error_reporting(0);
- ini_set('display_errors', '1');
- class Record
- {
- var $RowsCount=0;
- var $Values= array(0 => array(0 => ""));
- var $FieldsCount=0;
- var $FieldNames=array();
- }
- class MYSQL
- {
- var $host;
- var $dbname;
- var $username;
- var $password;
- function MYSQL()
- {
- $this->host = "localhost";
- $this->dbname = "ilasro_maindb";
- $this->username = "ilasro_andrei";
- $this->password = "^iLas.r0$461";
- /*
- $this->host = "localhost";
- $this->dbname = "u420762715_ilas";
- $this->username = "u420762715_user";
- $this->password = "^iLas.r0$";
- $this->host="localhost";
- $this->dbname="ilasro_ilas";
- $this->username="ilasro";
- $this->password="kata&lystea6";*/
- //$this->password="G56FVEr5nQen6P4X";
- }
- function __destruct()
- {}
- function execQuery($query)
- {
- // Connecting to server
- $rd=new Record();
- $link = mysql_connect($this->host , $this->username , $this->password) or die('Could not connect: ' . mysql_error());
- //Selecting database
- mysql_select_db($this->dbname) or die('Could not select database');
- /****************************
- GET the Field Names
- ********************************/
- $result = mysql_query($query) or die('Query failed: ' . mysql_error());
- $row=mysql_fetch_array($result, MYSQL_ASSOC);
- $fieldsCount=count($row);
- if($fieldsCount>1)
- {
- for($j=0;$j<$fieldsCount;$j++)
- {
- $rd->FieldNames[$j]=key($row);
- next($row);
- }
- }
- mysql_free_result($result);
- /****************************
- GET the Field Values
- ********************************/
- $result = mysql_query($query) or die('Query failed: ' . mysql_error());
- $rowindex=0;
- while ($rd->Values[$rowindex] = mysql_fetch_array($result, MYSQL_NUM))
- {
- $rowindex=$rowindex+1;
- }
- $rd->RowsCount=$rowindex;
- $rd->FieldsCount=$fieldsCount;
- // Free resultset
- mysql_free_result($result);
- // Closing connection
- mysql_close($link);
- return $rd;
- }
- function execStatement($query)
- {
- // Connecting to server
- $link = mysql_connect($this->host , $this->username , $this->password) or die('Could not connect: ' . mysql_error());
- //Selecting database
- mysql_select_db($this->dbname) or die('Could not select database');
- $result = mysql_query($query) or die('Query failed: ' . mysql_error());
- // Closing connection
- mysql_close($link);
- return 1;
- }
- }
- function SafeStr($str)
- {
- $str1 = str_replace("'","`",$str);
- $str1 = mysql_real_escape_string($str);
- return $str1;
- }
- function txtTruncate($text, $limit, $break=".", $pad="...")
- {
- $text = $text." ";
- $text = substr($text,0,$limit);
- $text = substr($text,0,strrpos($text,' '));
- $text = $text."...";
- return $text;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement