Jump to content

lalaila

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lalaila's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Can you just fix this error? im bad i PHP thanks
  2. Hi! Neel help fixing Strict Standards: Non-static method users::count() should not be called statically, assuming $this from incompatible context in /home/gint/public_html/skelbimai/classes/groups.php on [b][color=red]line 131[/color][/b] Strict Standards: Non-static method users::count() should not be called statically, assuming $this from incompatible context in /home/gint/public_html/skelbimai/classes/groups.php on [b][color=red]line 131[/color][/b] Strict Standards: Non-static method users::count() should not be called statically, assuming $this from incompatible context in /home/gint/public_html/skelbimai/classes/groups.php on [b][color=red]line 131[/color][/b] <?php /*********************/ /* */ /* Version : 5.1.0 */ /* Author : RM */ /* Comment : 071223 */ /* */ /*********************/ class groups { public function groups( $id = 0 ) { } public function getid( ) { return $this->id; } public function getname( $id = "" ) { global $db; global $crt_lang; if ( !$id ) { $id = $this->id; } if ( $id == 1000 ) { global $lng; return clean( $lng['packages']['not_logged_in'] ); } $uname = $db->fetchRow( "select `name` from ".TABLE_USER_GROUPS."_lang where id={$id} and `lang_id`='{$crt_lang}'" ); return $uname; } public function getpackagepending( $id = "" ) { global $db; if ( !$id ) { $id = $this->id; } $ar = $db->fetchRow( "select `package_pending` from ".TABLE_USER_GROUPS." where id=\"".$id."\"" ); return $ar; } public function getlistingpending( $id = "" ) { global $db; if ( !$id ) { global $settings; return $settings['nologin_pending_listing']; } $ar = $db->fetchRow( "select `listing_pending` from ".TABLE_USER_GROUPS." where id=\"".$id."\"" ); return $ar; } public function getactivateaccount( $id = "" ) { global $db; if ( !$id ) { $id = $this->id; } $act = $db->fetchRow( "select activate_account from ".TABLE_USER_GROUPS." where id=\"".$id."\"" ); return $act; } public function getadminverification( $id = "" ) { global $db; if ( !$id ) { $id = $this->id; } $act = $db->fetchRow( "select admin_verification from ".TABLE_USER_GROUPS." where id=\"".$id."\"" ); return $act; } public function getstore( $id = "" ) { global $db; if ( !$id ) { $id = $this->id; } $ar = $db->fetchRow( "select `store` from ".TABLE_USER_GROUPS." where id=\"".$id."\"" ); return $ar; } public function getgroup( $id = "" ) { global $db; global $crt_lang; if ( !$id ) { $id = $this->id; } $result = $db->fetchAssoc( "select * from ".TABLE_USER_GROUPS." LEFT JOIN ".TABLE_USER_GROUPS."_lang on ".TABLE_USER_GROUPS.".`id` = ".TABLE_USER_GROUPS."_lang.`id` where ".TABLE_USER_GROUPS.".id='{$id}' and `lang_id` = '{$crt_lang}'" ); return $result; } public function getnoactive( ) { global $db; $no = $db->fetchRow( "select count(*) from ".TABLE_USER_GROUPS." where active=1" ); return $no; } public function nodefactivegroup( ) { global $db; $group = $db->fetchRow( "select id from ".TABLE_USER_GROUPS." where active=1" ); return $group; } public function getall( ) { global $db; global $crt_lang; $array = $db->fetchAssocList( "select ".TABLE_USER_GROUPS.".*, ".TABLE_USER_GROUPS."_lang.* from ".TABLE_USER_GROUPS." LEFT JOIN ".TABLE_USER_GROUPS."_lang on ".TABLE_USER_GROUPS.".`id` = ".TABLE_USER_GROUPS."_lang.`id` where `lang_id` = '{$crt_lang}' order by `order_no`" ); $i = 0; $array_groups = array( ); foreach ( $array as $result ) { $array_groups[$i] = $result; [color=red][b]line 131: [/b][/color] [color=red]$array_groups[$i]['users'] = users::count( $result['id'] );[/color] $array_groups[$i]['last'] = 0; if ( $i % 2 ) { $array_groups[$i]['style'] = "_odd"; } else { $array_groups[$i]['style'] = "_even"; } ++$i; } if ( $i ) { $array_groups[$i - 1]['last'] = 1; } return $array_groups; } public function getshortgroups( ) { global $db; global $crt_lang; $array = $db->fetchAssocList( "select ".TABLE_USER_GROUPS.".*, ".TABLE_USER_GROUPS."_lang.* from ".TABLE_USER_GROUPS." LEFT JOIN ".TABLE_USER_GROUPS."_lang on ".TABLE_USER_GROUPS.".`id` = ".TABLE_USER_GROUPS."_lang.`id` where `lang_id` = '{$crt_lang}' order by `order_no`" ); $i = 0; foreach ( $array as $result ) { $array[$i]['name'] = clean( $result['name'] ); ++$i; } return $array; } public function getallregister( ) { global $db; global $crt_lang; $array = $db->fetchAssocList( "select * from ".TABLE_USER_GROUPS." LEFT JOIN ".TABLE_USER_GROUPS."_lang on ".TABLE_USER_GROUPS.".`id` = ".TABLE_USER_GROUPS."_lang.`id` where auto_register=1 and `active`=1 and `lang_id` = '{$crt_lang}' order by `order_no`" ); $i = 0; $array_usr = array( ); foreach ( $array as $result ) { $array_groups[$i] = $result; if ( $i % 2 ) { $array_groups[$i]['style'] = "_odd"; } else { $array_groups[$i]['style'] = "_even"; } ++$i; } return $array_groups; } public function exists( $id ) { global $db; $res = $db->query( "select * from ".TABLE_USER_GROUPS." where id='{$id}'" ); if ( $db->numRows( $res ) ) { return 1; } return 0; } public function nodefregistergroup( ) { global $db; $group = $db->fetchRow( "select id from ".TABLE_USER_GROUPS." where auto_register=1 and active=1" ); return $group; } public function nodefgroup( ) { global $db; $group = $db->fetchRow( "select id from ".TABLE_USER_GROUPS." where active=1" ); return $group; } } ?> thanks all for help!
  3. Hi, Need help fixing Mysql error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gint/public_html/skelbimai/classes/mysql.php on [color=red]line 235[/color] Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gint/public_html/skelbimai/classes/mysql.php on [color=red]line 235[/color] Warning: Cannot modify header information - headers already sent by (output started at /home/gint/public_html/skelbimai/classes/mysql.php:235) in /home/gint/public_html/skelbimai/admin/addgroup.php on [color=red]line 30[/color] <?php class db_mysql { public function db_mysql( ) { global $config_db_server; global $config_db_server_username; global $config_db_server_password; global $config_db_database; $password = str_replace( "\$", "\$", $config_db_server_password ); $this->link = @mysql_connect( $config_db_server, $config_db_server_username, $password ); $this->errorQuery = array( ); $this->error = ""; $this->limit = ""; $this->offset = ""; $this->errorPath = ""; if ( $this->link ) { if ( @mysql_select_db( $config_db_database, $this->link ) ) { $this->recent_link =& $this->link; global $config_db_charset; global $config_db_collation; global $mysql_locale; global $mysql_names; if ( $mysql_locale != "" ) { mysql_query( "SET lc_time_names = '".$mysql_locale."'" ); } if ( $mysql_names != "" ) { mysql_query( "SET NAMES {$mysql_names}" ); } return $this->link; } $this->errorPath = $this->getErrorPath( ); $this->error = "Could not select database: {$config_db_database}"; } else { $this->error = "Could not connect to server: {$config_db_server}"; $this->errorPath = $this->getErrorPath( ); } } public function test( ) { return 1; } public function geterror( ) { global $config_debug; $str = "<span>Database query error. </span>"; if ( $config_debug ) { $str .= "<span>The error was: </span>".$this->error; $str .= "<br><span>SQL query/queries : </span>".$this->printErrorQuery( )."<span>Error path:</span> ".$this->errorPath; } return $str; } public function printerrorquery( ) { $result = ""; foreach ( $this->errorQuery as $str ) { $result .= $str."<br>"; } return $result; } public function setsql( $sql ) { $this->sql = $sql; } public function getsql( ) { return $this->sql; } public function query( $sql = "" ) { if ( $sql ) { $this->sql = $sql; } if ( !is_resource( $this->link ) ) { return false; } $this->recent_link =& $this->link; if ( 0 < $this->limit || 0 < $this->offset ) { $this->sql .= " LIMIT ".$this->offset.", ".$this->limit; } $result = @mysql_query( $this->sql, $this->link ); ++$this->query_count; if ( !$result ) { $this->error( ); $this->errorPath = $this->getErrorPath( ); return false; } return $result; } public function fetchrow( $sql = "" ) { if ( $sql ) { $this->sql = $sql; } if ( !( $result = $this->query( ) ) ) { return null; } $ret = null; if ( $row = @mysql_fetch_row( $result ) ) { $ret = $row[0]; } $this->freeResult( $result ); return $ret; } public function fetchrowres( $result ) { $ret = null; if ( $row = @mysql_fetch_row( $result ) ) { $ret = $row[0]; } return $ret; } public function fetchassocres( $result ) { $ret = null; if ( $row = @mysql_fetch_assoc( $result ) ) { $ret = $row; } return $ret; } public function fetchrowlist( $sql = "" ) { if ( $sql ) { $this->sql = $sql; } if ( !( $result = $this->query( ) ) ) { return null; } $array = array( ); while ( $row = @mysql_fetch_row( $result ) ) { $array[] = $row[0]; } $this->freeResult( $result ); return $array; } public function fetchassoc( $sql = "" ) { if ( $sql ) { $this->sql = $sql; } if ( !( $result = $this->query( ) ) ) { return null; } $ret = null; if ( $row = @mysql_fetch_assoc( $result ) ) { $ret = $row; } $this->freeResult( $result ); return $ret; } public function fetchassoclist( $sql = "" ) { if ( $sql ) { $this->sql = $sql; } if ( !( $result = $this->query( ) ) ) { return null; } $array = array( ); while ( $row = @mysql_fetch_assoc( $result ) ) { $array[] = $row; } $this->freeResult( $result ); return $array; } public function fetcharray( $sql = "" ) { if ( $sql ) { $this->sql = $sql; } if ( !( $result = $this->query( ) ) ) { return null; } $array = array( ); while ( $row = @mysql_fetch_array( $result ) ) { $array[] = $row; } $this->freeResult( $result ); return $array; } public function numrows( $result ) { [color=red][b]line 235[/b][/color] return mysql_num_rows( $result ); } public function affectedrows( ) { return mysql_affected_rows( $this->recent_link ); } public function numqueries( ) { return $this->query_count; } public function insertid( ) { return mysql_insert_id( $this->link ); } public function freeresult( $result ) { return mysql_free_result( $result ); } public function setoffset( $off ) { $this->offset = $off; } public function setlimit( $lim ) { $this->limit = $lim; } public function close( ) { $this->sql = ""; return mysql_close( $this->link ); } public function error( $err = "" ) { if ( $err ) { $this->error .= $err; } else { if ( is_null( $this->recent_link ) ) { return; } $this->error = " errno : ".mysql_errno( $this->recent_link )." ".mysql_error( $this->recent_link ); } $no = count( $this->errorQuery ); $this->errorQuery[$no] = $this->sql; return $this->error; } public function geterrorpath( ) { if ( $_SERVER['REQUEST_URI'] ) { $errorpath = $_SERVER['REQUEST_URI']; } else { if ( $_SERVER['PATH_INFO'] ) { $errorpath = $_SERVER['PATH_INFO']; } else { $errorpath = $_SERVER['PHP_SELF']; } if ( $_SERVER['QUERY_STRING'] ) { $errorpath .= "?".$_SERVER['QUERY_STRING']; } } if ( ( $pos = strpos( $errorpath, "?" ) ) !== false ) { $errorpath = urldecode( substr( $errorpath, 0, $pos ) ).substr( $errorpath, $pos ); } else { $errorpath = urldecode( $errorpath ); } return $_SERVER['HTTP_HOST'].$errorpath; } public function gettablefields( $table ) { $array = array( ); $res = mysql_query( "DESCRIBE ".$table ); $i = 0; while ( $row = mysql_fetch_row( $res ) ) { $array[$i] = $row[0]; ++$i; } return $array; } public function getfulltablefields( $table ) { $array = array( ); $res = mysql_query( "DESCRIBE ".$table ); $i = 0; while ( $row = mysql_fetch_assoc( $res ) ) { $array[$i]['Field'] = $row['Field']; $array[$i]['Type'] = $row['Type']; ++$i; } return $array; } public function gettablecsvfields( $table ) { $fields = ""; $res = mysql_query( "DESCRIBE ".$table ); $i = 0; while ( $row = mysql_fetch_row( $res ) ) { if ( $i ) { $fields .= ","; } $fields .= $row[0]; ++$i; } return $fields; } public function gettexttablefields( $table ) { $array = array( ); $res = mysql_query( "DESCRIBE ".$table ); $i = 0; while ( $row = mysql_fetch_row( $res ) ) { if ( !strstr( $row[1], "varchar" ) && $row[1] != "text" ) { continue; } $array[$i] = $row[0]; ++$i; } return $array; } public function gettables( $prefix = "", $not_prefix = "" ) { if ( !( $result = $this->fetchRowList( "SHOW TABLES" ) ) ) { return 0; } if ( !$prefix ) { return $result; } $i = 0; $arr = array( ); foreach ( $result as $row ) { if ( preg_match( "/^{$prefix}/", $row ) && !preg_match( "/^{$not_prefix}/", $row ) ) { $arr[$i++] = $row; } } return $arr; } } ?> Thanks all for help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.